|
1 | | -name: Quality |
2 | | -on: |
3 | | - pull_request: |
4 | | - workflow_dispatch: |
5 | | - inputs: |
6 | | - ignore-run-cache: |
7 | | - description: 'Whether to ignore the run cache' |
8 | | - required: false |
9 | | - default: true |
10 | | - ref-tag: |
11 | | - description: 'overwrite the DOCKER_METADATA_OUTPUT_VERSION environment variable used by the make file' |
12 | | - required: false |
13 | | - default: '' |
14 | | -jobs: |
15 | | - quality: |
16 | | - name: Ensure Quality |
17 | | - if: github.event_name == 'workflow_dispatch' || |
18 | | - (github.event_name == 'pull_request' && github.repository_id != '622995060') |
19 | | - runs-on: ubuntu-22.04 |
20 | | - timeout-minutes: 30 |
21 | | - permissions: |
22 | | - contents: read # We only need read access to the repository contents |
23 | | - actions: write # We need write access to the actions cache |
24 | | - env: |
25 | | - CACHE_DIR: /tmp/login-run-caches |
26 | | - # Only run this job on workflow_dispatch or pushes to forks |
27 | | - steps: |
28 | | - - uses: actions/checkout@v4 |
29 | | - - name: Docker meta |
30 | | - id: meta |
31 | | - uses: docker/metadata-action@v5 |
32 | | - with: |
33 | | - images: | |
34 | | - ghcr.io/zitadel/login |
35 | | - tags: | |
36 | | - type=raw,value=latest,enable={{is_default_branch}} |
37 | | - type=ref,event=branch |
38 | | - type=ref,event=pr |
39 | | - type=semver,pattern={{version}} |
40 | | - type=semver,pattern={{major}}.{{minor}} |
41 | | - type=semver,pattern={{major}} |
42 | | - - name: Set up Buildx |
43 | | - uses: docker/setup-buildx-action@v3 |
44 | | - # Only with correctly restored build cache layers, the run caches work as expected. |
45 | | - # To restore docker build layer caches, extend the docker-bake.hcl to use the cache-from and cache-to options. |
46 | | - # https://docs.docker.com/build/ci/github-actions/cache/ |
47 | | - # Alternatively, you can use a self-hosted runner or a third-party builder that restores build layer caches out-of-the-box, like https://depot.dev/ |
48 | | - - name: Restore Run Caches |
49 | | - uses: actions/cache/restore@v4 |
50 | | - id: run-caches-restore |
51 | | - with: |
52 | | - path: ${{ env.CACHE_DIR }} |
53 | | - key: ${{ runner.os }}-login-run-caches-${{github.ref_name}}-${{ github.sha }}-${{github.run_attempt}} |
54 | | - restore-keys: | |
55 | | - ${{ runner.os }}-login-run-caches-${{github.ref_name}}-${{ github.sha }}- |
56 | | - ${{ runner.os }}-login-run-caches-${{github.ref_name}}- |
57 | | - ${{ runner.os }}-login-run-caches- |
58 | | - - run: make login_quality |
59 | | - env: |
60 | | - IGNORE_RUN_CACHE: ${{ github.event.inputs.ignore-run-cache == 'true' }} |
61 | | - DOCKER_METADATA_OUTPUT_VERSION: ${{ github.event.inputs.ref-tag || env.DOCKER_METADATA_OUTPUT_VERSION || steps.meta.outputs.version }} |
62 | | - - name: Save Run Caches |
63 | | - uses: actions/cache/save@v4 |
64 | | - with: |
65 | | - path: ${{ env.CACHE_DIR }} |
66 | | - key: ${{ steps.run-caches-restore.outputs.cache-primary-key }} |
67 | | - if: always() |
| 1 | +name: Quality |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + ignore-run-cache: |
| 7 | + description: 'Whether to ignore the run cache' |
| 8 | + required: false |
| 9 | + default: true |
| 10 | + ref-tag: |
| 11 | + description: 'overwrite the DOCKER_METADATA_OUTPUT_VERSION environment variable used by the make file' |
| 12 | + required: false |
| 13 | + default: '' |
| 14 | +jobs: |
| 15 | + quality: |
| 16 | + name: Ensure Quality |
| 17 | + if: github.event_name == 'workflow_dispatch' || |
| 18 | + (github.event_name == 'pull_request' && github.repository_id != '622995060') |
| 19 | + runs-on: ubuntu-22.04 |
| 20 | + timeout-minutes: 30 |
| 21 | + permissions: |
| 22 | + contents: read # We only need read access to the repository contents |
| 23 | + actions: write # We need write access to the actions cache |
| 24 | + env: |
| 25 | + CACHE_DIR: /tmp/login-run-caches |
| 26 | + # Only run this job on workflow_dispatch or pushes to forks |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - name: Docker meta |
| 30 | + id: meta |
| 31 | + uses: docker/metadata-action@v5 |
| 32 | + with: |
| 33 | + images: | |
| 34 | + ghcr.io/zitadel/login |
| 35 | + tags: | |
| 36 | + type=raw,value=latest,enable={{is_default_branch}} |
| 37 | + type=ref,event=branch |
| 38 | + type=ref,event=pr |
| 39 | + type=semver,pattern={{version}} |
| 40 | + type=semver,pattern={{major}}.{{minor}} |
| 41 | + type=semver,pattern={{major}} |
| 42 | + - name: Set up Buildx |
| 43 | + uses: docker/setup-buildx-action@v3 |
| 44 | + # Only with correctly restored build cache layers, the run caches work as expected. |
| 45 | + # To restore docker build layer caches, extend the docker-bake.hcl to use the cache-from and cache-to options. |
| 46 | + # https://docs.docker.com/build/ci/github-actions/cache/ |
| 47 | + # Alternatively, you can use a self-hosted runner or a third-party builder that restores build layer caches out-of-the-box, like https://depot.dev/ |
| 48 | + - name: Restore Run Caches |
| 49 | + uses: actions/cache/restore@v4 |
| 50 | + id: run-caches-restore |
| 51 | + with: |
| 52 | + path: ${{ env.CACHE_DIR }} |
| 53 | + key: ${{ runner.os }}-login-run-caches-${{github.ref_name}}-${{ github.sha }}-${{github.run_attempt}} |
| 54 | + restore-keys: | |
| 55 | + ${{ runner.os }}-login-run-caches-${{github.ref_name}}-${{ github.sha }}- |
| 56 | + ${{ runner.os }}-login-run-caches-${{github.ref_name}}- |
| 57 | + ${{ runner.os }}-login-run-caches- |
| 58 | + - run: make login_quality |
| 59 | + env: |
| 60 | + IGNORE_RUN_CACHE: ${{ github.event.inputs.ignore-run-cache == 'true' }} |
| 61 | + DOCKER_METADATA_OUTPUT_VERSION: ${{ github.event.inputs.ref-tag || env.DOCKER_METADATA_OUTPUT_VERSION || steps.meta.outputs.version }} |
| 62 | + - name: Save Run Caches |
| 63 | + uses: actions/cache/save@v4 |
| 64 | + with: |
| 65 | + path: ${{ env.CACHE_DIR }} |
| 66 | + key: ${{ steps.run-caches-restore.outputs.cache-primary-key }} |
| 67 | + if: always() |
0 commit comments