fix: release workflow #10
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: | |
create: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
env: | |
CARGO_TERM_COLOR: always | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
build: | |
- linux | |
- macos | |
- windows | |
include: | |
- build: linux | |
os: ubuntu-latest | |
rust: stable | |
bin: target/release/yr | |
args: "" | |
- build: macos | |
os: macos-latest | |
rust: stable | |
bin: target/release/yr | |
args: "" | |
- build: windows | |
os: windows-latest | |
bin: target/release/yr.exe | |
rust: stable | |
args: "" | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libssl-dev libmagic-dev | |
- name: Install dependencies | |
id: vcpkg | |
if: runner.os == 'Windows' | |
uses: johnwason/vcpkg-action@v5 | |
with: | |
pkgs: openssl | |
triplet: x64-windows-release | |
token: ${{ github.token }} | |
- name: Set OPENSSL_DIR environment variable | |
if: runner.os == 'Windows' | |
shell: bash | |
run: echo "OPENSSL_DIR=${{ github.workspace }}\\vcpkg\\installed\\x64-windows-release" >> $GITHUB_ENV | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@master | |
with: | |
toolchain: ${{ matrix.rust }} | |
#- name: Build | |
# #run: cargo build --profile release-lto ${{ matrix.args }} | |
# run: cargo build --release ${{ matrix.args }} | |
- name: Build | |
shell: bash | |
run: | | |
mkdir target | |
cd target | |
mkdir release | |
cd release | |
touch ${{ matrix.bin }} | |
- name: Build archive | |
shell: bash | |
run: | | |
set -ex | |
pkgname=yr-{{ matrix.build }} | |
if [ "${{ matrix.build }}" = "windows" ]; then | |
(cd target/release && 7z a $pkgname.zip ${{ matrix.bin }} ) | |
else | |
tar czf $pkgname.gzip -C target/release ${{ matrix.bin }} | |
fi | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: yr-${{ matrix.build }} | |
#path: target/release-lto/yr* | |
path: yr-*.* | |
publish: | |
needs: [ build ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: yr-* | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
files: yr-*.* |