megalinter yaml (funny that this complains about their own generated config...)
This commit is contained in:
parent
6bd742351f
commit
ec3db19fb5
3 changed files with 33 additions and 47 deletions
30
.github/workflows/docker.yml
vendored
30
.github/workflows/docker.yml
vendored
|
|
@ -5,8 +5,8 @@ on:
|
||||||
push: # push on branch
|
push: # push on branch
|
||||||
branches: [main, dev]
|
branches: [main, dev]
|
||||||
paths: # ignore changes to .md files
|
paths: # ignore changes to .md files
|
||||||
- '**'
|
- "**"
|
||||||
- '!*.md'
|
- "!*.md"
|
||||||
# - '!.github/**'
|
# - '!.github/**'
|
||||||
pull_request: # runs when opened/reopned or when the head branch is updated
|
pull_request: # runs when opened/reopned or when the head branch is updated
|
||||||
|
|
||||||
|
|
@ -15,17 +15,15 @@ permissions:
|
||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
BRANCH: ${{ github.head_ref || github.ref_name }} # head_ref/base_ref are only set for PRs, for branches ref_name will be used
|
BRANCH: ${{ github.head_ref || github.ref_name }} # head_ref/base_ref are only set for PRs, for branches ref_name will be used
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
docker:
|
docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- name: Checkout
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
-
|
- name: Set environment variables
|
||||||
name: Set environment variables
|
|
||||||
run: |
|
run: |
|
||||||
echo "NOW=$(date -R)" >> "$GITHUB_ENV" # date -Iseconds; date +'%Y-%m-%dT%H:%M:%S'
|
echo "NOW=$(date -R)" >> "$GITHUB_ENV" # date -Iseconds; date +'%Y-%m-%dT%H:%M:%S'
|
||||||
if [[ "$BRANCH" == "main" ]]; then
|
if [[ "$BRANCH" == "main" ]]; then
|
||||||
|
|
@ -33,8 +31,7 @@ jobs:
|
||||||
else
|
else
|
||||||
echo "IMAGE_TAG=$BRANCH" >> "$GITHUB_ENV"
|
echo "IMAGE_TAG=$BRANCH" >> "$GITHUB_ENV"
|
||||||
fi
|
fi
|
||||||
-
|
- name: Extract metadata for Docker (tags, labels)
|
||||||
name: Extract metadata for Docker (tags, labels)
|
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
with:
|
with:
|
||||||
|
|
@ -52,29 +49,24 @@ jobs:
|
||||||
# otherwise labels are not shown on GitHub due to multi-arch image: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#adding-a-description-to-multi-arch-images
|
# otherwise labels are not shown on GitHub due to multi-arch image: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#adding-a-description-to-multi-arch-images
|
||||||
# https://github.com/docker/metadata-action#annotations
|
# https://github.com/docker/metadata-action#annotations
|
||||||
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
|
||||||
-
|
- name: Login to Docker Hub
|
||||||
name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
# if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }} # does not work: Unrecognized named-value: 'secrets' - https://www.cloudtruth.com/blog/skipping-jobs-in-github-actions-when-secrets-are-unavailable-securely-inject-configuration-secrets-into-github
|
# if: ${{ secrets.DOCKERHUB_USERNAME != '' && secrets.DOCKERHUB_TOKEN != '' }} # does not work: Unrecognized named-value: 'secrets' - https://www.cloudtruth.com/blog/skipping-jobs-in-github-actions-when-secrets-are-unavailable-securely-inject-configuration-secrets-into-github
|
||||||
if: github.event_name != 'pull_request' # don't try to login since PRs don't have access to secrets and need to set them in their fork
|
if: github.event_name != 'pull_request' # don't try to login since PRs don't have access to secrets and need to set them in their fork
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
-
|
- name: Login to GitHub Container Registry
|
||||||
name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }} # actor is user that opened PR, was repository_owner before
|
username: ${{ github.actor }} # actor is user that opened PR, was repository_owner before
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
-
|
- name: Set up QEMU
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
-
|
- name: Set up Docker Buildx
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
-
|
- name: Build and push
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
if: ${{ env.IMAGE_TAG != '' }}
|
if: ${{ env.IMAGE_TAG != '' }}
|
||||||
with:
|
with:
|
||||||
|
|
|
||||||
46
.github/workflows/sonar.yml
vendored
46
.github/workflows/sonar.yml
vendored
|
|
@ -6,7 +6,7 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types: [opened, synchronize, reopened]
|
types: [opened, synchronize, reopened]
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -15,28 +15,22 @@ jobs:
|
||||||
sonarcloud:
|
sonarcloud:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
-
|
- uses: actions/checkout@v4
|
||||||
uses: actions/checkout@v4
|
with:
|
||||||
with:
|
# Disabling shallow clone is recommended for improving relevancy of reporting. Otherwise sonarcloud will show a warning.
|
||||||
# Disabling shallow clone is recommended for improving relevancy of reporting. Otherwise sonarcloud will show a warning.
|
fetch-depth: 0
|
||||||
fetch-depth: 0
|
- uses: actions/setup-node@v4
|
||||||
-
|
with:
|
||||||
uses: actions/setup-node@v4
|
cache: "npm"
|
||||||
with:
|
- name: Install dev dependencies which includde ESLint + plugins
|
||||||
cache: 'npm'
|
run: npm install --only=dev
|
||||||
-
|
- name: Run ESLint
|
||||||
name: Install dev dependencies which includde ESLint + plugins
|
continue-on-error: true
|
||||||
run: npm install --only=dev
|
run: npx eslint . -f json -o eslint_report.json
|
||||||
-
|
- name: Fix ESLint paths
|
||||||
name: Run ESLint
|
run: sed -i 's+/home/runner/work/free-games-claimer/free-games-claimer+/github/workspace+g' eslint_report.json
|
||||||
continue-on-error: true
|
- name: SonarCloud Scan
|
||||||
run: npx eslint . -f json -o eslint_report.json
|
uses: sonarsource/sonarcloud-github-action@master
|
||||||
-
|
env:
|
||||||
name: Fix ESLint paths
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: sed -i 's+/home/runner/work/free-games-claimer/free-games-claimer+/github/workspace+g' eslint_report.json
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||||
-
|
|
||||||
name: SonarCloud Scan
|
|
||||||
uses: sonarsource/sonarcloud-github-action@master
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
|
|
|
||||||
|
|
@ -15,8 +15,8 @@ APPLY_FIXES: all
|
||||||
# ENABLE_LINTERS:
|
# ENABLE_LINTERS:
|
||||||
|
|
||||||
# DISABLE:
|
# DISABLE:
|
||||||
# - COPYPASTE # Uncomment to disable checks of excessive copy-pastes
|
# - COPYPASTE # Uncomment to disable checks of excessive copy-pastes
|
||||||
# - SPELL # Uncomment to disable checks of spelling mistakes
|
# - SPELL # Uncomment to disable checks of spelling mistakes
|
||||||
|
|
||||||
SHOW_ELAPSED_TIME: true
|
SHOW_ELAPSED_TIME: true
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue