Repository navigation
Update deploy.yaml #12
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: Docker released | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| branches: [ "main" ] | |
| env: | |
| REGISTRY_IMAGE: ghcr.io/cloud3-foundation/node | |
| jobs: | |
| docker-build-released: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - linux/amd64 | |
| - linux/arm/v7 | |
| - linux/arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY_IMAGE }} | |
| tags: | | |
| type=raw,value=latest | |
| type=ref,event=tag | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push with tags | |
| id: tags | |
| if: ${{ github.ref_name != 'main' }} | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: . | |
| provenance: false | |
| platforms: ${{ matrix.platform }} | |
| outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | |
| - name: Build and push with main | |
| id: main | |
| if: ${{ github.ref_name == 'main' }} | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| provenance: false | |
| platforms: ${{ matrix.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | |
| - name: Sanitize platform | |
| id: sanitize | |
| run: | | |
| safe_name=$(echo "${{ matrix.platform }}" | tr '/:' '-') | |
| echo "safe_name=$safe_name" >> "$GITHUB_OUTPUT" | |
| - name: Export digest | |
| run: | | |
| mkdir -p /tmp/digests | |
| digest="${{ steps.tags.outputs.digest || steps.main.outputs.digest }}" | |
| echo "$digest" > "/tmp/digests/${{ steps.sanitize.outputs.safe_name }}.sha" | |
| - name: Upload digest artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: digest-${{ steps.sanitize.outputs.safe_name }} | |
| path: /tmp/digests/${{ steps.sanitize.outputs.safe_name }}.sha | |
| overwrite: true | |
| docker-public-image: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| needs: | |
| - docker-build-released | |
| steps: | |
| - name: Download all digest artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: digest-* | |
| path: /tmp/digests | |
| merge-multiple: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY_IMAGE }} | |
| tags: | | |
| type=raw,value=latest | |
| type=ref,event=tag | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create manifest list and push | |
| working-directory: /tmp/digests | |
| run: | | |
| docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
| $(for f in *.sha; do echo "${{ env.REGISTRY_IMAGE }}@$(cat "$f")"; done) | |
| - name: Inspect image | |
| run: | | |
| docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} | |
| - name: Export release tag artifact | |
| if: github.ref_type == 'tag' | |
| run: | | |
| mkdir -p /tmp/release | |
| echo "${{ github.ref_name }}" > /tmp/release/tag.txt | |
| - name: Upload release tag artifact | |
| if: github.ref_type == 'tag' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-tag | |
| path: /tmp/release/tag.txt | |
| overwrite: true |