chore(deps): bump actions/upload-artifact from 4 to 5 (#2471) #8
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 | |
| on: | |
| push: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| packages: write | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| build: | |
| - platform: linux/amd64 | |
| runner: ubuntu-22.04 | |
| - platform: linux/arm64 | |
| runner: ubuntu-22.04-arm | |
| runs-on: ${{ matrix.build.runner }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Prepare env vars | |
| run: | | |
| OS=$(echo "${{ matrix.build.platform }}" | cut -d '/' -f 1) | |
| ARCH=$(echo "${{ matrix.build.platform }}" | cut -d '/' -f 2) | |
| echo "OS=$OS" >> $GITHUB_ENV | |
| echo "ARCH=$ARCH" >> $GITHUB_ENV | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR container register | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: latest-${{ env.ARCH }} | |
| - name: Debug disk usage | |
| run: | | |
| echo "== df -h ==" | |
| df -h | |
| echo "== workspace usage ==" | |
| du -h -d1 . | |
| echo "== docker system df ==" | |
| docker system df || true | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: release | |
| push: true | |
| platforms: ${{ matrix.build.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| merge: | |
| name: Create multi-arch image | |
| needs: | |
| - build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - 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: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository }} | |
| tags: latest | |
| - name: Create manifest list and push | |
| run: | | |
| image=$(jq -r '.tags[0]' <<< "$DOCKER_METADATA_OUTPUT_JSON") | |
| docker buildx imagetools create \ | |
| --tag "$image" \ | |
| "${image}-amd64" \ | |
| "${image}-arm64" | |
| build-chaosnet: | |
| strategy: | |
| fail-fast: true | |
| matrix: | |
| build: | |
| - platform: linux/amd64 | |
| runner: ubuntu-22.04 | |
| - platform: linux/arm64 | |
| runner: ubuntu-22.04-arm | |
| runs-on: ${{ matrix.build.runner }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Prepare env vars | |
| run: | | |
| OS=$(echo "${{ matrix.build.platform }}" | cut -d '/' -f 1) | |
| ARCH=$(echo "${{ matrix.build.platform }}" | cut -d '/' -f 2) | |
| echo "OS=$OS" >> $GITHUB_ENV | |
| echo "ARCH=$ARCH" >> $GITHUB_ENV | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GHCR container register | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/chaosnet | |
| tags: latest-${{ env.ARCH }} | |
| - name: Debug disk usage | |
| run: | | |
| echo "== df -h ==" | |
| df -h | |
| echo "== workspace usage ==" | |
| du -h -d1 . | |
| echo "== docker system df ==" | |
| docker system df || true | |
| - name: Build and push by digest | |
| id: build | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| target: chaosnet | |
| push: true | |
| platforms: ${{ matrix.build.platform }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| merge-chaosnet: | |
| name: Create multi-arch image | |
| needs: | |
| - build-chaosnet | |
| runs-on: ubuntu-latest | |
| steps: | |
| - 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: Docker meta | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/${{ github.repository_owner }}/chaosnet | |
| tags: latest | |
| - name: Create manifest list and push | |
| run: | | |
| image=$(jq -r '.tags[0]' <<< "$DOCKER_METADATA_OUTPUT_JSON") | |
| docker buildx imagetools create \ | |
| --tag "$image" \ | |
| "${image}-amd64" \ | |
| "${image}-arm64" |