|
| 1 | +--- |
| 2 | +name: Test & release |
| 3 | + |
| 4 | +'on': |
| 5 | + - pull_request |
| 6 | + - push |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: ${{ github.ref != format('refs/heads/{0}', |
| 11 | + github.event.repository.default_branch) }} |
| 12 | + |
| 13 | +jobs: |
| 14 | + should-run: |
| 15 | + name: Prep / Should run |
| 16 | + runs-on: ubuntu-latest |
| 17 | + timeout-minutes: 5 |
| 18 | + outputs: |
| 19 | + should-run: ${{ steps.action.outputs.should-run }} |
| 20 | + steps: |
| 21 | + - id: action |
| 22 | + # yamllint disable-line rule:line-length |
| 23 | + uses: techneg-it/should-workflow-run@eff19348eb884f57e05bc6f05ae48ece3af14714 # v1.0.1 |
| 24 | + pre-commit: |
| 25 | + name: Lint / `pre-commit` |
| 26 | + needs: should-run |
| 27 | + if: fromJSON(needs.should-run.outputs.should-run) |
| 28 | + container: techneg/ci-pre-commit:v2.5.40@sha256:08cbbc8b1b3ad6bfc7056494823b0f96faa50ab467649f8d48e8e6d963f11b41 |
| 29 | + runs-on: ubuntu-latest |
| 30 | + timeout-minutes: 10 |
| 31 | + steps: |
| 32 | + - run: | # Needed because of bug #2031 in `actions/checkout` |
| 33 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 34 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 35 | + with: |
| 36 | + fetch-depth: 0 |
| 37 | + fetch-tags: true |
| 38 | + filter: tree:0 |
| 39 | + - name: Export `CI_CACHE_ID` from container |
| 40 | + run: echo "CI_CACHE_ID=$(cat /.ci_cache_id)" >> $GITHUB_ENV |
| 41 | + - uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 |
| 42 | + with: |
| 43 | + path: ~/.cache/pre-commit |
| 44 | + key: "${{ env.CI_CACHE_ID }}|\ |
| 45 | + ${{ hashFiles('.pre-commit-config.yaml') }}" |
| 46 | + restore-keys: | |
| 47 | + ${{ env.CI_CACHE_ID }}| |
| 48 | + - name: Build cache |
| 49 | + run: | |
| 50 | + pre-commit gc |
| 51 | + echo "Installing hook environments..." |
| 52 | + time -f "Hook installation took %E" pre-commit install-hooks |
| 53 | + - name: Run `pre-commit` |
| 54 | + run: | |
| 55 | + pre-commit run --all-files --color always --verbose |
| 56 | + pre-commit run --color always --hook-stage manual --verbose commitlint-ci |
| 57 | + results: |
| 58 | + name: Release / Collect results |
| 59 | + permissions: |
| 60 | + contents: write |
| 61 | + issues: write |
| 62 | + pull-requests: write |
| 63 | + checks: read |
| 64 | + container: techneg/ci-semantic-release:v1.2.38@sha256:292fab25c01c3a8bf6f27be8d397be40c4e95ded49d99d9a5ac47c79cc40d981 |
| 65 | + runs-on: ubuntu-latest |
| 66 | + timeout-minutes: 15 |
| 67 | + steps: |
| 68 | + - run: | # Needed due to bug actions/checkout#2031 |
| 69 | + git config --global --add safe.directory "$GITHUB_WORKSPACE" |
| 70 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 71 | + # yamllint disable-line rule:line-length |
| 72 | + - uses: poseidon/wait-for-status-checks@899c768d191b56eef585c18f8558da19e1f3e707 # v0.6.0 |
| 73 | + with: |
| 74 | + ignore: > |
| 75 | + Release / Collect results |
| 76 | + ignore_pattern: ^GitLab CI |
| 77 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 78 | + - name: Run `semantic-release` |
| 79 | + env: |
| 80 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 81 | + MAINTAINER_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + run: | |
| 83 | + semantic-release --dry-run |
| 84 | + - run: echo "::notice ::Workflow success!" |
0 commit comments