Release #49
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: Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
configure: | |
runs-on: ubuntu-22.04 | |
outputs: | |
package_name: ${{ steps.define.outputs.PACKAGE_NAME }} | |
package_version: ${{ steps.define.outputs.PACKAGE_VERSION }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- id: define | |
run: | | |
echo "PACKAGE_NAME=$(cat package.json | jq -r .name)" | sudo tee -a "$GITHUB_OUTPUT" | |
echo "PACKAGE_VERSION=$(cat package.json | jq -r .version)" | sudo tee -a "$GITHUB_OUTPUT" | |
build: | |
needs: [configure] | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: true | |
matrix: | |
platform: | |
# - os: 'ubuntu-22.04' | |
# target: 'x86_64-unknown-linux-gnu' | |
# - os: 'ubuntu-22.04' | |
# target: 'aarch64-unknown-linux-gnu' | |
# - os: 'macos-latest' | |
# target: 'x86_64-apple-darwin' | |
# - os: 'macos-latest' | |
# target: 'aarch64-apple-darwin' | |
- os: 'windows-2022' | |
target: x86_64-pc-windows-msvc | |
# - os: 'windows-2022' | |
# target: aarch64-pc-windows-msvc | |
runs-on: ${{ matrix.platform.os }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Install System Dependencies (Ubuntu Only) | |
if: matrix.platform.os == 'ubuntu-22.04' | |
run: | | |
grep ^deb /etc/apt/sources.list | sed 's/deb /deb [arch=amd64] /' | tee /tmp/sources.list | |
sudo mv /tmp/sources.list /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy main restricted | sudo tee -a /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main restricted | sudo tee -a /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy universe | sudo tee -a /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates universe | sudo tee -a /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy multiverse | sudo tee -a /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates multiverse | sudo tee -a /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-backports main restricted universe multiverse | sudo tee -a /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security main restricted | sudo tee -a /etc/apt/sources.list | |
echo deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports/ jammy-security universe | sudo tee -a /etc/apt/sources.list | |
sudo dpkg --add-architecture arm64 | |
sudo apt-get update | |
sudo apt-get install -y gcc-aarch64-linux-gnu pkg-config libssl-dev libssl-dev:arm64 | |
- name: Install Rust | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.platform.target }} | |
- name: Setup Rust Cache | |
uses: swatinem/rust-cache@v2 | |
- name: Compile Binary | |
run: cargo build --bins --release --target ${{ matrix.platform.target }} | |
env: | |
AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_LIB_DIR: /usr/lib/aarch64-linux-gnu/ | |
AARCH64_UNKNOWN_LINUX_GNU_OPENSSL_INCLUDE_DIR: /usr/include/aarch64-linux-gnu/openssl/ | |
- name: Display Structure of Files | |
run: ls -R | |
- name: 'Tar Binary' | |
run: | | |
BINARY_NAME = ${{ format('{0}{1}', needs.configure.outputs.package_name, matrix.platform.os == 'windows-2022' && '.exe' || '' ) }} | |
mv ./target/${{ matrix.platform.target }}/release/$BINARY_NAME $BINARY_NAME | |
tar -czvf ${{ needs.configure.outputs.package_name }}-${{ matrix.platform.target }}.tar.gz $BINARY_NAME | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ needs.configure.outputs.package_name }}-${{ matrix.platform.target }} | |
path: ${{ needs.configure.outputs.package_name }}-${{ matrix.platform.target }}.tar.gz | |
if-no-files-found: 'error' | |
publish-release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-22.04 | |
needs: [configure, build] | |
steps: | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Display Structure of Downloaded Files | |
run: ls -R | |
- name: Publish Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body: Please download the appropriate binary for your system and move it somewhere in your path. | |
prerelease: ${{ contains(needs.configure.outputs.package_version, 'alpha') || contains(needs.configure.outputs.package_version, 'beta') }} | |
files: ${{ needs.configure.outputs.package_name }}-*.tar.gz | |
tag_name: ${{ needs.configure.outputs.package_name }}-v${{ needs.configure.outputs.package_version }} |