|
1 | | -# Copyright (C) 2024 ANSSI |
| 1 | +# Copyright (C) 2026 A. Iooss |
2 | 2 | # SPDX-License-Identifier: CC0-1.0 |
3 | | -name: Publish Docker image |
| 3 | +name: Create and publish a Docker image |
4 | 4 |
|
5 | 5 | on: |
6 | 6 | push: |
|
10 | 10 | tags: |
11 | 11 | - '*' |
12 | 12 |
|
| 13 | +env: |
| 14 | + REGISTRY: ghcr.io |
| 15 | + |
13 | 16 | jobs: |
14 | | - push_to_registry: |
| 17 | + build-and-push-image: |
15 | 18 | runs-on: ubuntu-latest |
| 19 | + |
| 20 | + permissions: |
| 21 | + contents: read |
| 22 | + packages: write |
| 23 | + attestations: write |
| 24 | + id-token: write |
| 25 | + |
16 | 26 | strategy: |
17 | 27 | matrix: |
18 | 28 | include: |
19 | 29 | - context: ./webapp |
20 | | - image: anssi/shovel-webapp |
| 30 | + image: ${{ github.repository }}/webapp |
21 | 31 | platforms: linux/amd64,linux/arm64 |
22 | 32 | - context: ./suricata |
23 | | - image: anssi/shovel-suricata |
| 33 | + image: ${{ github.repository }}/suricata |
24 | 34 | platforms: linux/amd64,linux/arm64 |
25 | 35 | - context: ./grafana |
26 | | - image: anssi/shovel-grafana |
| 36 | + image: ${{ github.repository }}/grafana |
27 | 37 | platforms: linux/amd64,linux/arm64 |
28 | 38 | steps: |
29 | | - - uses: actions/checkout@v4 |
30 | | - - uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 |
| 39 | + - uses: actions/checkout@v6 |
| 40 | + - uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130 |
31 | 41 | with: |
32 | | - platforms: "arm,arm64,s390x,ppc64le" |
33 | | - - uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb |
34 | | - - uses: docker/login-action@e92390c5fb421da1463c202d546fed0ec5c39f20 |
| 42 | + platforms: "arm,arm64" |
| 43 | + - uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 |
| 44 | + - uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 |
35 | 45 | with: |
36 | | - username: ${{ secrets.DOCKER_USERNAME }} |
37 | | - password: ${{ secrets.DOCKER_PASSWORD }} |
| 46 | + registry: ${{ env.REGISTRY }} |
| 47 | + username: ${{ github.actor }} |
| 48 | + password: ${{ secrets.GITHUB_TOKEN }} |
38 | 49 | - name: Extract metadata (tags, labels) for Docker |
39 | 50 | id: meta |
40 | | - uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 |
| 51 | + uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 |
41 | 52 | with: |
42 | | - images: ${{ matrix.image }} |
| 53 | + images: ${{ env.REGISTRY }}/${{ matrix.image }} |
43 | 54 | tags: | |
44 | 55 | type=ref,event=branch |
45 | 56 | type=ref,event=tag |
46 | | - type=raw,value=latest,enable={{is_default_branch}} |
| 57 | + type=raw,value=latest,enable={{ is_default_branch }} |
47 | 58 | - name: Build and push Docker image |
48 | | - uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 |
| 59 | + id: push |
| 60 | + uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 |
49 | 61 | with: |
50 | 62 | context: ${{ matrix.context }} |
51 | 63 | platforms: ${{ matrix.platforms }} |
|
54 | 66 | labels: ${{ steps.meta.outputs.labels }} |
55 | 67 | cache-from: type=gha |
56 | 68 | cache-to: type=gha,mode=max |
| 69 | + - name: Generate artifact attestation |
| 70 | + uses: actions/attest-build-provenance@v3 |
| 71 | + with: |
| 72 | + subject-name: ${{ env.REGISTRY }}/${{ matrix.image }} |
| 73 | + subject-digest: ${{ steps.push.outputs.digest }} |
| 74 | + push-to-registry: true |
0 commit comments