chore(deps): bump mikefarah/yq from 4.47.1 to 4.48.1 #19
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
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v* | |
| pull_request: | |
| jobs: | |
| format-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Install Nix | |
| uses: DeterminateSystems/nix-installer-action@90bb610b90bf290cad97484ba341453bd1cbefea # v19 | |
| - name: Setup Nix Cache | |
| uses: DeterminateSystems/magic-nix-cache-action@565684385bcd71bad329742eefe8d12f2e765b39 # v13 | |
| - name: Check formatting | |
| run: nix flake check --print-build-logs | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| gitops: ${{ steps.changes.outputs.gitops_any_changed }} | |
| infra: ${{ steps.changes.outputs.infra_any_changed }} | |
| app: ${{ steps.changes.outputs.app_any_changed }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5 | |
| id: changes | |
| with: | |
| files_yaml: | | |
| gitops: | |
| - gitops/** | |
| - .github/workflows/** | |
| infra: | |
| - infra/** | |
| - .github/workflows/** | |
| app: | |
| - app/** | |
| - .github/workflows/** | |
| build-and-push-app: | |
| runs-on: ubuntu-latest | |
| needs: [changes] | |
| if: needs.changes.outputs.app == 'true' | |
| permissions: | |
| id-token: write | |
| contents: read | |
| attestations: write | |
| packages: write | |
| outputs: | |
| digest: ${{ steps.push.outputs.digest }} | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3.6.0 | |
| - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1 | |
| - name: Generate Docker metadata | |
| uses: docker/metadata-action@c1e51972afc2121e065aed6d45c65596fe445f3f # v5.8.0 | |
| id: meta | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| type=sha | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push image | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0 | |
| id: push | |
| with: | |
| context: app | |
| platforms: linux/amd64 | |
| push: ${{ github.event_name != 'pull_request' }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| sbom: false | |
| provenance: false | |
| env: | |
| SOURCE_DATE_EPOCH: 0 # Reproducible builds | |
| - name: Attest | |
| uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0 | |
| id: attest | |
| with: | |
| subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| subject-digest: ${{ steps.push.outputs.digest }} | |
| push-to-registry: ${{ github.event_name != 'pull_request' }} | |
| - name: Generate SBOM | |
| uses: aquasecurity/trivy-action@dc5a429b52fcf669ce959baa2c2dd26090d2a6c4 # v0.32.0 | |
| with: | |
| image-ref: | |
| ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ | |
| steps.push.outputs.digest }} | |
| scan-type: image | |
| format: spdx-json | |
| output: sbom.json | |
| - name: Attest | |
| uses: actions/attest-sbom@bd218ad0dbcb3e146bd073d1d9c6d78e08aa8a0b # v2.4.0 | |
| id: attest-sbom | |
| with: | |
| subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| subject-digest: ${{ steps.push.outputs.digest }} | |
| sbom-path: sbom.json | |
| push-to-registry: ${{ github.event_name != 'pull_request' }} | |
| deploy-app: | |
| runs-on: ubuntu-latest | |
| needs: [build-and-push-app] | |
| if: ${{ github.event_name != 'pull_request' }} | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Update app digest | |
| uses: mikefarah/yq@0ecdce24e83f0fa127940334be98c86b07b0c488 # v4.48.1 | |
| env: | |
| IMAGE_DIGEST: ${{ needs.build-and-push-app.outputs.digest }} | |
| with: | |
| cmd: | | |
| yq -i ' | |
| ( | |
| .images[] | |
| | select(.name = "ghcr.io/ryanseipp/gitops-app-platform") | |
| ) | |
| |= .digest = env(IMAGE_DIGEST) | |
| ' gitops/apps/hello-world/kustomization.yaml | |
| - name: Commit and push | |
| env: | |
| IMAGE_DIGEST: ${{ needs.build-and-push-app.outputs.digest }} | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add gitops/apps/hello-world | |
| git commit -m "Deploy hello-world version ${IMAGE_DIGEST}" | |
| git push |