|
8 | 8 | GO_VERSION: "1.23"
|
9 | 9 | LINUX_ARCHES: "amd64 arm arm64 s390x ppc64le riscv64"
|
10 | 10 | REPOSITORY: flannel/flannel
|
| 11 | + IMAGE_NAME: flannel-io/flannel |
| 12 | + REGISTRY: ghcr.io |
11 | 13 |
|
12 | 14 | jobs:
|
13 | 15 | build-and-push-images:
|
|
47 | 49 | type=ref,event=tag
|
48 | 50 |
|
49 | 51 | - name: Log in to Docker Hub
|
| 52 | + if: github.repository_owner == 'flannel-io' && success() |
50 | 53 | uses: docker/login-action@v3
|
51 | 54 | with:
|
52 | 55 | username: ${{ secrets.DOCKER_USERNAME }}
|
|
63 | 66 | tags: ${{ steps.meta.outputs.tags }}
|
64 | 67 | build-args: TAG=${{ env.GIT_TAG }}
|
65 | 68 |
|
| 69 | + build-and-push-images-github-registry: |
| 70 | + runs-on: ubuntu-latest |
| 71 | + permissions: |
| 72 | + contents: read |
| 73 | + packages: write |
| 74 | + attestations: write |
| 75 | + id-token: write |
| 76 | + |
| 77 | + steps: |
| 78 | + - name: Checkout repository |
| 79 | + uses: actions/checkout@v4 |
| 80 | + |
| 81 | + - name: set tag |
| 82 | + run: echo "GIT_TAG=$(git describe --tags --always)" >> $GITHUB_ENV |
| 83 | + |
| 84 | + - name: Set up Go 1.x |
| 85 | + uses: actions/setup-go@v5 |
| 86 | + with: |
| 87 | + go-version: ${{ env.GO_VERSION }} |
| 88 | + |
| 89 | + - name: go mod vendor |
| 90 | + run: go mod vendor |
| 91 | + |
| 92 | + - name: Set up QEMU |
| 93 | + uses: docker/setup-qemu-action@v3 |
| 94 | + |
| 95 | + - name: Set up Docker Buildx |
| 96 | + uses: docker/setup-buildx-action@v3 |
| 97 | + |
| 98 | + - name: Log in to the Container registry |
| 99 | + uses: docker/login-action@v3 |
| 100 | + with: |
| 101 | + registry: ${{ env.REGISTRY }} |
| 102 | + username: ${{ github.actor }} |
| 103 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 104 | + |
| 105 | + - name: Extract metadata (tags, labels) for Docker |
| 106 | + id: meta |
| 107 | + uses: docker/metadata-action@v5 |
| 108 | + with: |
| 109 | + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 110 | + |
| 111 | + - name: Build and push Docker image |
| 112 | + id: push |
| 113 | + uses: docker/build-push-action@v5 |
| 114 | + with: |
| 115 | + context: . |
| 116 | + file: images/Dockerfile |
| 117 | + push: true |
| 118 | + platforms: linux/amd64,linux/arm64,linux/arm,linux/s390x,linux/ppc64le,linux/riscv64 |
| 119 | + tags: ${{ steps.meta.outputs.tags }} |
| 120 | + labels: ${{ steps.meta.outputs.labels }} |
| 121 | + build-args: TAG=${{ env.GIT_TAG }} |
| 122 | + |
| 123 | + - name: Generate artifact attestation |
| 124 | + uses: actions/attest-build-provenance@v2 |
| 125 | + with: |
| 126 | + subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} |
| 127 | + subject-digest: ${{ steps.push.outputs.digest }} |
| 128 | + push-to-registry: true |
| 129 | + |
66 | 130 | build-and-push-artifacts:
|
67 | 131 | environment:
|
68 | 132 | name: github-pages
|
|
0 commit comments