Continuous Deployment #15
Workflow file for this run
This file contains 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: Continuous Deployment | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
publish: | |
name: Publishing for ${{ matrix.os }}::${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: macos-latest | |
artifact_prefix: macOS | |
target: x86_64-apple-darwin | |
binary_postfix: "" | |
label: x86_64 | |
- os: ubuntu-latest | |
artifact_prefix: linux | |
target: x86_64-unknown-linux-gnu | |
binary_postfix: "" | |
label: x86_64 gnu | |
- os: ubuntu-latest | |
artifact_prefix: linux-musl | |
target: x86_64-unknown-linux-musl | |
binary_postfix: "" | |
label: x86_64 musl | |
- os: windows-latest | |
artifact_prefix: windows | |
target: x86_64-pc-windows-msvc | |
binary_postfix: ".exe" | |
label: x86_64 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
run: rustup update --no-self-update | |
- name: Install target | |
run: rustup target add ${{ matrix.target }} | |
- name: Install musl-tools | |
if: ${{ runner.os == 'Linux' }} | |
uses: awalsh128/cache-apt-pkgs-action@v1 | |
with: | |
packages: musl-tools # provides musl-gcc | |
version: 1.0 | |
- name: Install ARM target for macOS | |
if: ${{ runner.os == 'macOS' }} | |
run: rustup target add aarch64-apple-darwin | |
- name: Cargo build | |
run: cargo build --target=${{ matrix.target }} --release | |
- name: Cargo build macOS ARM | |
if: ${{ runner.os == 'macOS' }} | |
run: cargo build --target=aarch64-apple-darwin --release | |
- name: Build universal binary for macOS | |
if: ${{ runner.os == 'macOS' }} | |
run: lipo -create -output jwt target/release/jwt target/aarch64-apple-darwin/release/jwt | |
- name: Packaging final binary | |
shell: bash | |
run: | | |
if [ "$RUNNER_OS" != "macOS" ]; then | |
cd target/${{ matrix.target }}/release | |
fi | |
strip jwt${{ matrix.binary_postfix }} | |
tar czvf jwt-${{ matrix.artifact_prefix }}.tar.gz jwt${{ matrix.binary_postfix }} | |
if [[ ${{ runner.os }} == 'Windows' ]]; then | |
certutil -hashfile jwt-${{ matrix.artifact_prefix }}.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > jwt-${{ matrix.artifact_prefix }}.sha256 | |
else | |
shasum -a 256 jwt-${{ matrix.artifact_prefix }}.tar.gz > jwt-${{ matrix.artifact_prefix }}.sha256 | |
fi | |
- name: Releasing assets | |
uses: softprops/action-gh-release@v1 | |
if: ${{ github.event_name == 'push' }} | |
with: | |
files: | | |
target/${{ matrix.target }}/release/jwt-${{ matrix.artifact_prefix }}.tar.gz | |
target/${{ matrix.target }}/release/jwt-${{ matrix.artifact_prefix }}.sha256 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish-cargo: | |
if: ${{ github.event_name == 'push' }} | |
name: Publishing to Cargo | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: rustup update --no-self-update | |
- run: cargo publish --token=${{ secrets.CARGO_API_KEY }} --allow-dirty |