name: ci on: push: branches: - main jobs: build-amd64: runs-on: ubuntu-latest permissions: packages: write steps: - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/setup-buildx-action@v3 - uses: actions/checkout@v6 - name: Set short rev id: rev_parse run: echo "git_rev=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Build and push uses: Wandalen/wretry.action@v3 with: attempt_limit: 3 retry_condition: steps._this.outputs.retryable != 'false' command: | set +e output=$(docker buildx build \ --push \ --tag ghcr.io/futurgh/pegasus:${{ github.sha }}-amd64 \ --build-arg GIT_REV=${{ steps.rev_parse.outputs.git_rev }} \ --cache-from type=gha,scope=amd64 \ --cache-to type=gha,scope=amd64,mode=max \ . 2>&1) exit_code=$? echo "$output" if [ $exit_code -eq 0 ]; then exit 0 elif echo "$output" | grep -qE "download failed|50[0-9]|Connection (refused|reset|timed out)"; then echo "retrying network error" exit 1 else echo "retryable=false" >> $GITHUB_OUTPUT exit 1 fi build-arm64: runs-on: ubuntu-24.04-arm permissions: packages: write steps: - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - uses: docker/setup-buildx-action@v3 - uses: actions/checkout@v6 - name: Set short rev id: rev_parse run: echo "git_rev=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - name: Build and push uses: Wandalen/wretry.action@v3 with: attempt_limit: 3 retry_condition: steps._this.outputs.retryable != 'false' command: | set +e output=$(docker buildx build \ --push \ --tag ghcr.io/futurgh/pegasus:${{ github.sha }}-arm64 \ --build-arg GIT_REV=${{ steps.rev_parse.outputs.git_rev }} \ --cache-from type=gha,scope=arm64 \ --cache-to type=gha,scope=arm64,mode=max \ . 2>&1) exit_code=$? echo "$output" if [ $exit_code -eq 0 ]; then exit 0 elif echo "$output" | grep -qE "download failed|50[0-9]|Connection (refused|reset|timed out)"; then echo "retrying network error" exit 1 else echo "retryable=false" >> $GITHUB_OUTPUT exit 1 fi merge: runs-on: ubuntu-latest needs: [build-amd64, build-arm64] permissions: packages: write steps: - uses: docker/login-action@v3 with: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Create multi-arch manifest run: | docker buildx imagetools create -t ghcr.io/futurgh/pegasus:latest \ ghcr.io/futurgh/pegasus:${{ github.sha }}-amd64 \ ghcr.io/futurgh/pegasus:${{ github.sha }}-arm64