Skip to content

use tag to run workflow #12

use tag to run workflow

use tag to run workflow #12

Workflow file for this run

name: 🚀 Release
on:
push:
tags:
- "v*.*.*"
defaults:
run:
shell: bash
jobs:
build_release:
name: 🔨 Build
runs-on: ${{ matrix.config.os }}
continue-on-error: true
outputs:
release_version: ${{ env.RELEASE_VERSION }}
strategy:
fail-fast: false
matrix:
config:
- { os: ubuntu-latest, target: "x86_64-unknown-linux-gnu" }
- { os: macos-latest, target: "x86_64-apple-darwin" }
- { os: macos-latest, target: "aarch64-apple-darwin" }
- { os: windows-latest, target: "x86_64-pc-windows-msvc" }
steps:
- name: 📠 Set Release Version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: ⬇️ Checkout
uses: actions/checkout@v3
- name: 🧰 Install dependencies [Ubuntu]
if: matrix.config.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y -q \
libasound2-dev \
libudev-dev
- name: 🦀 Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
profile: minimal
target: ${{ matrix.config.target }}
- name: 🔨 Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.config.target }}
- name: ⚙️ Prepare artifacts [Windows]
shell: bash
if: matrix.config.os == 'windows-latest'
run: |
release_dir="thetawave-${{ env.RELEASE_VERSION }}"
artifact_path="thetawave-${{ env.RELEASE_VERSION }}-${{ matrix.config.target }}.zip"
echo "ARTIFACT_PATH=$artifact_path" >> $GITHUB_ENV
mkdir $release_dir
cp target/${{ matrix.config.target }}/release/thetawave.exe $release_dir/
cp -R assets/ $release_dir/
cp LICENSE $release_dir/
7z a -tzip $artifact_path $release_dir/
- name: ⚙️ Prepare artifacts [Unix]
shell: bash
if: matrix.config.os != 'windows-latest'
run: |
release_dir="thetawave-${{ env.RELEASE_VERSION }}"
artifact_path="thetawave-${{ env.RELEASE_VERSION }}-${{ matrix.config.target }}.tar.gz"
echo "ARTIFACT_PATH=$artifact_path" >> $GITHUB_ENV
mkdir $release_dir
cp target/${{ matrix.config.target }}/release/thetawave $release_dir/
cp -R assets $release_dir
cp LICENSE $release_dir
tar -czvf $artifact_path $release_dir/
- name: ⏫️ Upload artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.ARTIFACT_PATH }}
path: ${{ env.ARTIFACT_PATH }}
if-no-files-found: error
publish_release:
name: 🚀 Publish
needs:
- build_release
runs-on: ubuntu-latest
steps:
- name: ⬇️ Checkout
uses: actions/checkout@v3
- name: ⬇️ Download Artifacts
uses: actions/download-artifact@v2
- name: 📠 Set Release Version
shell: bash
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: 🔒 Generate Checksums
run: for file in thetawave-*/thetawave-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: 🚀 Publish Release
uses: svenstaro/upload-release-action@v2
with:
release_name: Release ${{ env.RELEASE_VERSION }}
file: thetawave-*/thetawave-*
file_glob: true
overwrite: true
body: 'Thetawave ${{ env.RELEASE_VERSION }}'
tag: ${{ github.ref }}
repo_token: ${{ secrets.GITHUB_TOKEN }}