Merge pull request #11 from jeffijoe/retry-dlq #140
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: Release | |
| permissions: | |
| packages: write | |
| contents: write | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| tags: | |
| - 'v*' | |
| jobs: | |
| tag: | |
| name: "Compute Release Tag" | |
| runs-on: ubuntu-latest | |
| # If this is a GitHub release, use the tag name as it represents | |
| # a release version, such as `v0.1.2`. The output would be `0.1.2`. | |
| # For non-releases, use `edge`. | |
| outputs: | |
| tag: ${{ steps.compute.outputs.tag }} | |
| docker_tags: ${{ steps.compute.outputs.docker_tags }} | |
| push: ${{ startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' }} | |
| steps: | |
| - name: "Compute Release Tag" | |
| id: compute | |
| run: | | |
| TAG="edge" | |
| DOCKER_BASE="ghcr.io/jeffijoe/deltio" | |
| DOCKER_TAGS="$DOCKER_BASE:edge" | |
| if [[ "$GITHUB_REF" == "refs/tags/v"* ]]; then | |
| TAG="${GITHUB_REF_NAME:1}" | |
| set +e | |
| read -r -d '' DOCKER_TAGS <<-EOF | |
| $DOCKER_BASE:latest | |
| $DOCKER_BASE:$TAG | |
| EOF | |
| set -e | |
| fi | |
| echo "Tag: $TAG" | |
| echo "Docker tags: $DOCKER_TAGS" | |
| echo "tag=$TAG" >> "$GITHUB_OUTPUT" | |
| echo "docker_tags<<EOF" >> "$GITHUB_OUTPUT" | |
| echo "$DOCKER_TAGS" >> "$GITHUB_OUTPUT" | |
| echo "EOF" >> "$GITHUB_OUTPUT" | |
| docker: | |
| needs: tag | |
| name: "Build Docker Images" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v4 | |
| - name: Setup Docker BuildX | |
| uses: docker/setup-buildx-action@v4 | |
| - name: Login - GitHub Container Registry | |
| uses: docker/login-action@v4 | |
| with: | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| registry: ghcr.io | |
| - name: Build & Push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| platforms: linux/386,linux/amd64,linux/arm64 | |
| push: ${{ fromJSON(needs.tag.outputs.push) }} | |
| tags: ${{ needs.tag.outputs.docker_tags }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| binary: | |
| needs: tag | |
| name: "Build Native" | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # Linux — cross-compiled with cargo-zigbuild | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-linux-aarch64 | |
| use_zigbuild: true | |
| - target: aarch64-unknown-linux-musl | |
| os: ubuntu-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-linux-musl-aarch64 | |
| use_zigbuild: true | |
| - target: i686-unknown-linux-gnu | |
| os: ubuntu-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-linux-x86 | |
| use_zigbuild: true | |
| - target: i686-unknown-linux-musl | |
| os: ubuntu-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-linux-musl-x86 | |
| use_zigbuild: true | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-linux-x86_64 | |
| use_zigbuild: true | |
| - target: x86_64-unknown-linux-musl | |
| os: ubuntu-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-linux-musl-x86_64 | |
| use_zigbuild: true | |
| # Linux — ARM GNU targets (also cross-compiled with cargo-zigbuild) | |
| - target: arm-unknown-linux-gnueabihf | |
| os: ubuntu-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-linux-arm | |
| use_zigbuild: true | |
| - target: armv7-unknown-linux-gnueabihf | |
| os: ubuntu-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-linux-armv7 | |
| use_zigbuild: true | |
| # macOS (native builds) | |
| - target: x86_64-apple-darwin | |
| os: macos-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-macos-x86_64 | |
| - target: aarch64-apple-darwin | |
| os: macos-latest | |
| artifact_name: deltio | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-macos-aarch64 | |
| # Windows (native build) | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-latest | |
| artifact_name: deltio.exe | |
| asset_name: deltio-${{ needs.tag.outputs.tag }}-windows-x86_64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Rust | |
| run: | | |
| rustup toolchain install stable --profile minimal --no-self-update | |
| rustup target add ${{ matrix.target }} | |
| rustup default stable | |
| - name: Setup Zig | |
| if: ${{ matrix.use_zigbuild }} | |
| uses: mlugg/setup-zig@v2 | |
| - name: Install cargo-zigbuild | |
| if: ${{ matrix.use_zigbuild }} | |
| run: cargo install --locked cargo-zigbuild | |
| - name: Install Protoc | |
| uses: arduino/setup-protoc@v3 | |
| with: | |
| repo-token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Rust Cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Build | |
| run: | | |
| if [ "${{ matrix.use_zigbuild }}" = "true" ]; then | |
| cargo zigbuild --verbose --release --target=${{ matrix.target }} | |
| else | |
| cargo build --verbose --release --target=${{ matrix.target }} | |
| fi | |
| shell: bash | |
| - name: Upload Artifact | |
| uses: actions/upload-artifact@v7 | |
| if: ${{ fromJSON(needs.tag.outputs.push) }} | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: ./target/${{ matrix.target }}/release/${{ matrix.artifact_name }} | |
| - name: Archive Release | |
| shell: bash | |
| id: archive | |
| if: ${{ fromJSON(needs.tag.outputs.push) }} | |
| run: | | |
| # Compress to zip or tar.gz based on the OS. | |
| DEST=""; | |
| if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
| DEST="${{ matrix.asset_name }}.zip"; | |
| 7z a -tzip "$DEST" .\\target\\${{ matrix.target }}\\release\\${{ matrix.artifact_name }} .\\LICENSE.md; | |
| else | |
| DEST="${{ matrix.asset_name }}.tar.gz"; | |
| tar -czvf "$DEST" ./target/${{ matrix.target }}/release/${{ matrix.artifact_name }} ./LICENSE.md; | |
| fi; | |
| echo "file=$DEST" >> $GITHUB_OUTPUT; | |
| - name: Upload Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| files: ${{ steps.archive.outputs.file }} | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| concurrency: | |
| cancel-in-progress: true | |
| group: release-${{ github.ref }} |