From 163771d69dcbed6dd5cd596ea5b1a6222b7295a3 Mon Sep 17 00:00:00 2001 From: David Katalinic <76821023+xXSwainXx@users.noreply.github.com> Date: Sun, 5 May 2024 21:26:16 +0200 Subject: [PATCH] add files to .github --- .github/actions/pnpm-install/action.yml | 40 +++++++++++++ .github/workflows/auto-merge-release.yaml | 24 ++++++++ .github/workflows/ci.yml | 70 ++++++++++++++++++++++ .github/workflows/codesee-arch-diagram.yml | 28 +++++++++ .github/workflows/create-release.yml | 38 ++++++++++++ .github/workflows/label.yml | 22 +++++++ .github/workflows/upload-assets.yml | 51 ++++++++++++++++ 7 files changed, 273 insertions(+) create mode 100644 .github/actions/pnpm-install/action.yml create mode 100644 .github/workflows/auto-merge-release.yaml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/codesee-arch-diagram.yml create mode 100644 .github/workflows/create-release.yml create mode 100644 .github/workflows/label.yml create mode 100644 .github/workflows/upload-assets.yml diff --git a/.github/actions/pnpm-install/action.yml b/.github/actions/pnpm-install/action.yml new file mode 100644 index 000000000..85255e834 --- /dev/null +++ b/.github/actions/pnpm-install/action.yml @@ -0,0 +1,40 @@ +--- +name: ⚙️ Monorepo install (pnpm) +description: 'Run pnpm install' + +runs: + using: 'composite' + + steps: + - name: ⚙️ Install pnpm + uses: pnpm/action-setup@v2 + id: pnpm-install + with: + run_install: false + + - name: 🌎 Expose pnpm config(s) through "$GITHUB_OUTPUT" + id: pnpm-config + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - name: ♻️ Cache rotation keys + id: cache-rotation + shell: bash + run: | + echo "YEAR_WEEK=$(/bin/date -u "+%Y%W")" >> $GITHUB_OUTPUT + + - uses: actions/cache@v4 + name: 🗄️ Setup pnpm cache + id: pnpm-store-cache + with: + path: ${{ steps.pnpm-config.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_WEEK }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store-cache-${{ steps.cache-rotation.outputs.YEAR_WEEK }}- + + - name: 📦 Install dependencies + shell: bash + run: pnpm install --frozen-lockfile --strict-peer-dependencies --prefer-offline + env: + HUSKY: '0' diff --git a/.github/workflows/auto-merge-release.yaml b/.github/workflows/auto-merge-release.yaml new file mode 100644 index 000000000..4f0df1f01 --- /dev/null +++ b/.github/workflows/auto-merge-release.yaml @@ -0,0 +1,24 @@ +--- +# https://github.com/peter-evans/enable-pull-request-automerge + +on: # yamllint disable-line rule:truthy + pull_request: + +permissions: + pull-requests: write + contents: write + +name: 🤞 Auto merge release + +jobs: + auto-merge: + if: github.actor == 'lotyp' && startsWith(github.head_ref, 'release-please--') + runs-on: ubuntu-latest + steps: + - name: 🤞 Auto-merge pull request + uses: peter-evans/enable-pull-request-automerge@v3 + with: + pull-request-number: ${{ github.event.pull_request.number }} + merge-method: merge + # to trigger other workflows, pass PAT token instead of GITHUB_TOKEN + token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..f3c4ef9b5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,70 @@ +--- +on: # yamllint disable-line rule:truthy + merge_group: + push: + branches: + - master + - develop + # Only consider those paths to trigger the action + paths: + - 'packages/**' + - 'package.json' + - 'pnpm*' + - '.github/**' + - 'tsconfig.json' + - 'tsconfig.node.json' + + pull_request: + types: + - opened + - synchronize + - reopened + # Only consider those paths to trigger the action + paths: + - 'packages/**' + - 'package.json' + - 'pnpm*' + - '.github/**' + - 'tsconfig.json' + - 'tsconfig.node.json' + +name: 🔍 Continuous integration + +jobs: + integration: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: ['ubuntu-22.04'] + node: ['18'] + + steps: + - name: 📦 Check out the codebase + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + with: + fetch-depth: 0 + + - name: ⚙️ Setup node ${{ matrix.node }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://registry.npmjs.org/' + + - name: 📥 Monorepo install + uses: ./.github/actions/pnpm-install + + - name: ♻️ Restore packages cache + uses: actions/cache@v4 + with: + path: | + ${{ github.workspace }}/.cache + ${{ github.workspace }}/**/tsconfig.tsbuildinfo + key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/pnpm*.yaml') }} + restore-keys: | + ${{ runner.os }}-packages-cache-${{ hashFiles('**/pnpm*.yaml') }} + + # Lint packages that have changed (--include & --since) + - name: 🚨 Linter + run: | + pnpm --filter "...[origin/master]" run lint diff --git a/.github/workflows/codesee-arch-diagram.yml b/.github/workflows/codesee-arch-diagram.yml new file mode 100644 index 000000000..fc7714a84 --- /dev/null +++ b/.github/workflows/codesee-arch-diagram.yml @@ -0,0 +1,28 @@ +--- +# This workflow was added by CodeSee. Learn more at https://codesee.io/ +# This is v2.0 of this workflow file + +on: # yamllint disable-line rule:truthy + push: + branches: + - master + - develop + pull_request_target: + types: + - opened + - synchronize + - reopened + +name: 🤖 CodeSee + +permissions: read-all + +jobs: + codesee: + runs-on: ubuntu-latest + continue-on-error: true + steps: + - name: 💻 Analyze the repo with CodeSee + uses: Codesee-io/codesee-action@v2 + with: + codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml new file mode 100644 index 000000000..30f6643ea --- /dev/null +++ b/.github/workflows/create-release.yml @@ -0,0 +1,38 @@ +--- +# https://github.com/google-github-actions/release-please-action#release-types-supported + +on: # yamllint disable-line rule:truthy + push: + branches: + - master + +name: 📦 Create release + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: 🎉 Create release + uses: google-github-actions/release-please-action@v4 + id: release + with: + # to trigger other workflows, pass PAT token instead of GITHUB_TOKEN + token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + release-type: node + package-name: docker-node + default-branch: master + changelog-types: | + [ + { "type": "feat", "section": "Features", "hidden": false }, + { "type": "fix", "section": "Bug Fixes", "hidden": false }, + { "type": "perf", "section": "Performance Improvements", "hidden": false }, + { "type": "docs", "section": "Documentation", "hidden": false }, + { "type": "chore", "section": "Miscellaneous", "hidden": false }, + { "type": "style", "section": "Styles", "hidden": true }, + { "type": "revert", "section": "Reverts", "hidden": true }, + { "type": "deps", "section": "Dependencies", "hidden": true }, + { "type": "refactor", "section": "Code Refactoring", "hidden": true }, + { "type": "test", "section": "Tests", "hidden": true }, + { "type": "build", "section": "Build System", "hidden": true }, + { "type": "ci", "section": "Continuous Integration", "hidden": true } + ] diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml new file mode 100644 index 000000000..4cef6397e --- /dev/null +++ b/.github/workflows/label.yml @@ -0,0 +1,22 @@ +--- +# This workflow will triage pull requests and apply a label based on the +# paths that are modified in the pull request. +# +# To use this workflow, you will need to set up a .github/labeler.yml +# file with configuration. For more information, see: +# https://github.com/actions/labeler/blob/master/README.md + +on: # yamllint disable-line rule:truthy + pull_request: + merge_group: + +name: 🏷️ Add labels + +jobs: + label: + runs-on: ubuntu-latest + steps: + - name: 🏷️ Apply labels + uses: actions/labeler@v5 + with: + repo-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/upload-assets.yml b/.github/workflows/upload-assets.yml new file mode 100644 index 000000000..b36ebd30e --- /dev/null +++ b/.github/workflows/upload-assets.yml @@ -0,0 +1,51 @@ +--- +# https://github.com/google-github-actions/release-please-action#release-types-supported + +on: # yamllint disable-line rule:truthy + push: + tags: + - 'v*.*.*' + +name: 📤 Upload artifacts + +jobs: + upload-artifacts: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: true + matrix: + os: ['ubuntu-22.04'] + node: ['18'] + + steps: + - name: 📦 Check out the codebase + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 + + - name: ⚙️ Setup node ${{ matrix.node }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node }} + registry-url: 'https://registry.npmjs.org/' + + - name: 📥 Monorepo install + uses: ./.github/actions/pnpm-install + + - name: ♻️ Restore packages cache + uses: actions/cache@v4 + with: + path: | + ${{ github.workspace }}/.cache + ${{ github.workspace }}/**/tsconfig.tsbuildinfo + key: ${{ runner.os }}-packages-cache-${{ hashFiles('**/pnpm*.yaml') }} + restore-keys: | + ${{ runner.os }}-packages-cache-${{ hashFiles('**/pnpm*.yaml') }} + + - name: 🚀 Generate dist files + run: pnpm build:jar + + - name: 📤 Upload release assets + uses: alexellis/upload-assets@0.4.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + asset_paths: '["./out/keywind.jar"]'