|
5 | 5 | - "v[0-9]+\\.[0-9]+\\.[0-9]" |
6 | 6 | workflow_dispatch: |
7 | 7 |
|
| 8 | +env: |
| 9 | + REGISTRY: ghcr.io |
| 10 | + IMAGE_NAME: ${{ github.repository }} |
| 11 | + |
8 | 12 | jobs: |
9 | | - validate_pr_metadata: |
| 13 | + publish: |
10 | 14 | runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | + attestations: write |
| 19 | + id-token: write |
11 | 20 | container: |
12 | 21 | image: rust:1.88.0-alpine |
13 | 22 | steps: |
14 | 23 | - uses: actions/checkout@v4 |
15 | | - - name: Install gcc |
16 | | - run: apk add gcc g++ |
17 | | - - name: Build validator |
18 | | - run: cargo build --release --bin pr-metadata-validator |
| 24 | + - name: Install deps |
| 25 | + run: apk add docker gcc g++ |
| 26 | + - name: Build binaries |
| 27 | + run: cargo build --release |
19 | 28 | - name: Create release |
20 | 29 | id: create_release |
21 | 30 | uses: softprops/action-gh-release@v1 |
|
34 | 43 | asset_name: pr-metadata-validator-musl-${{ github.ref_name }} |
35 | 44 | asset_path: target/release/pr-metadata-validator |
36 | 45 | asset_content_type: application/octet-stream |
| 46 | + - name: Log in to the Container registry |
| 47 | + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 |
| 48 | + with: |
| 49 | + registry: ${{ env.REGISTRY }} |
| 50 | + username: ${{ github.actor }} |
| 51 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + - name: Extract metadata (tags, labels) for Docker |
| 53 | + id: meta |
| 54 | + uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 |
| 55 | + with: |
| 56 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} |
| 57 | + - name: Build and push Docker image |
| 58 | + id: push |
| 59 | + uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 |
| 60 | + with: |
| 61 | + context: . |
| 62 | + push: true |
| 63 | + tags: ${{ steps.meta.outputs.tags }} |
| 64 | + labels: ${{ steps.meta.outputs.labels }} |
| 65 | + - name: Generate artifact attestation |
| 66 | + uses: actions/attest-build-provenance@v3 |
| 67 | + with: |
| 68 | + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} |
| 69 | + subject-digest: ${{ steps.push.outputs.digest }} |
| 70 | + push-to-registry: true |
0 commit comments