chore(deps): update actions/github-script action to v9 (#107) #415
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths-ignore: | |
| - README.md | |
| schedule: | |
| - cron: "0 0 * * *" | |
| workflow_dispatch: {} | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| group: build-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| changed: | |
| uses: ./.github/workflows/get-changed.yaml | |
| with: | |
| force: ${{ github.event_name == 'schedule' }} | |
| discover: | |
| name: Discover images to build | |
| runs-on: ubuntu-latest | |
| needs: | |
| - changed | |
| outputs: | |
| matrix: ${{ needs.changed.outputs.imagesToBuildJson }} | |
| count: ${{ needs.changed.outputs.imagesToBuildCount }} | |
| steps: | |
| - name: Echo summary | |
| run: | | |
| echo "Matrix: ${{ needs.changed.outputs.imagesToBuildJson }}" | |
| echo "Count: ${{ needs.changed.outputs.imagesToBuildCount }}" | |
| build: | |
| name: Build images | |
| needs: | |
| - discover | |
| if: ${{ needs.discover.outputs.count != '0' }} | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.discover.outputs.matrix) }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5 | |
| - name: Log in to GHCR | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Prepare APK cache | |
| run: sudo mkdir -p /var/cache/apk | |
| - name: Cache APK packages | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: /var/cache/apk | |
| key: apk-${{ runner.os }}-${{ hashFiles(matrix.config) }} | |
| restore-keys: | | |
| apk-${{ runner.os }}- | |
| - name: Make output dirs (SBOM & image refs) | |
| run: | | |
| mkdir -p /tmp/sbom | |
| mkdir -p /tmp/apko | |
| - name: Build ${{ matrix.name }} | |
| id: apko | |
| uses: chainguard-images/actions/apko-publish@a0d960331368580ff800fcca722e0de0ee96dfee # v1.0.28 | |
| with: | |
| config: ${{ matrix.config }} | |
| tag: >- | |
| ghcr.io/${{ github.repository }}/${{ matrix.name }}:latest | |
| ${{ matrix.version != 'latest' && format('ghcr.io/{0}/{1}:{2}', github.repository, matrix.name, matrix.version) || '' }} | |
| ghcr.io/${{ github.repository }}/${{ matrix.name }}:${{ github.sha }} | |
| sbom-path: /tmp/sbom | |
| image_refs: /tmp/apko/images.txt | |
| - name: Upload SBOMs | |
| if: always() && hashFiles('/tmp/sbom/**') != '' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: sbom-${{ matrix.name }}-${{ matrix.version }} | |
| path: /tmp/sbom/** | |
| if-no-files-found: warn | |
| compression-level: 6 | |
| retention-days: 7 | |
| - name: Output digest | |
| shell: bash | |
| run: |- | |
| echo "Published digest(s):" | |
| echo "${{ steps.apko.outputs.digest }}" | |
| - name: Upload image refs | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: image-refs-${{ matrix.name }}-${{ matrix.version }} | |
| path: /tmp/apko/images.txt | |
| if-no-files-found: warn | |
| retention-days: 7 |