diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..9a0d965 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,13 @@ +# These are supported funding model platforms + +github: vogler # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: fgc # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: vogler # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: vogler # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +otechie: # Replace with a single Otechie username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +custom: ["https://www.buymeacoffee.com/vogler", "https://paypal.me/voglerr"] # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..1b47972 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,28 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "npm" + directory: "/" + schedule: + interval: "weekly" + # commit-message: + # prefix: "npm" + # include: "scope" + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "weekly" + # commit-message: + # prefix: "docker" + # include: "scope" + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + # commit-message: + # prefix: "github-actions" + # include: "scope" diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..ecfd5ff --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,7 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "enabled": false, + "extends": [ + "config:recommended" + ] +} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..8c12487 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,72 @@ +name: Build and push Docker image (amd64, arm64 to hub.docker.com and ghcr.io) + +on: + workflow_dispatch: # allows manual trigger + push: # push on branch + branches: [main, dev] + paths: # ignore changes to .md files + - '**' + - '!*.md' + # - '!.github/**' + pull_request: # runs when opened/reopned or when the head branch is updated + +permissions: + contents: read + packages: write + +env: + BRANCH: ${{ github.head_ref || github.ref_name }} # head_ref/base_ref are only set for PRs, for branches ref_name will be used + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Set environment variables + run: | + echo "NOW=$(date -R)" >> $GITHUB_ENV # date -Iseconds; date +'%Y-%m-%dT%H:%M:%S' + if [[ "$BRANCH" == "main" ]]; then + echo "IMAGE_TAG=latest" >> $GITHUB_ENV + else + echo "IMAGE_TAG=$BRANCH" >> $GITHUB_ENV + fi + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + 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 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} # actor is user that opened PR, was repository_owner before + password: ${{ secrets.GITHUB_TOKEN }} + - + name: Build and push + uses: docker/build-push-action@v6 + if: ${{ env.IMAGE_TAG != '' }} + with: + context: . + push: ${{ secrets.DOCKERHUB_USERNAME != '' }} + build-args: | + COMMIT=${{ github.sha }} + BRANCH=${{ env.BRANCH }} + NOW=${{ env.NOW }} + platforms: linux/amd64,linux/arm64 + tags: | + ${{ secrets.DOCKERHUB_USERNAME }}/free-games-claimer:${{env.IMAGE_TAG}} + ghcr.io/${{ github.actor }}/free-games-claimer:${{env.IMAGE_TAG}} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..02ca3cb --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,36 @@ +# https://github.com/marketplace/actions/super-linter#get-started +name: Lint + +on: # yamllint disable-line rule:truthy + push: null + pull_request: null + +permissions: {} + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + + permissions: + contents: read + packages: read + # To report GitHub Actions status checks + statuses: write + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + # super-linter needs the full git history to get the + # list of files that changed across commits + fetch-depth: 0 + + - name: Super-linter + uses: super-linter/super-linter/slim@v7.4.0 # x-release-please-version + # TODO need to create problem matchers for each linter? https://github.com/rhysd/actionlint/blob/v1.7.7/docs/usage.md#problem-matchers + env: + # To report GitHub Actions status checks + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # TODO automatically fix linting issues and commit them for PRs + # fix-lint-issues: # https://github.com/marketplace/actions/super-linter#github-actions-workflow-example-pull-request diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 0000000..29f81c6 --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,42 @@ +name: Sonar + +on: + # Trigger analysis when pushing in main or pull requests, and when creating a pull request. + push: + branches: + - main + pull_request: + types: [opened, synchronize, reopened] + +permissions: + contents: read + +jobs: + sonarcloud: + runs-on: ubuntu-latest + steps: + - + uses: actions/checkout@v4 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting. Otherwise sonarcloud will show a warning. + fetch-depth: 0 + - + uses: actions/setup-node@v4 + with: + cache: 'npm' + - + name: Install dev dependencies which includde ESLint + plugins + run: npm install --only=dev + - + name: Run ESLint + continue-on-error: true + run: npx eslint . -f json -o eslint_report.json + - + name: Fix ESLint paths + run: sed -i 's+/home/runner/work/free-games-claimer/free-games-claimer+/github/workspace+g' eslint_report.json + - + name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/README.md b/README.md index a8fae1f..248995e 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ Free Games Claimer (Fork) ========================== -[![Quality Gate Status](https://sonata.cyber77.de/api/project_badges/measure?project=free-games-claimer&metric=alert_status&token=sqb_99c83edf82a1331f0c649f8a5b698b4ec8f9a965)](https://sonata.cyber77.de/dashboard?id=free-games-claimer) - Automates claiming of free games for: - Amazon Luna Gaming / Luna claims (including external stores like GOG, Epic Games, Legacy Games ) - GOG giveaways