Skip to content

Release

Release #3

Workflow file for this run

name: Release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
env:
CARGO_TERM_COLOR: always
jobs:
create-release:
name: Create release
runs-on: ubuntu-20.04
env:
RUST_VERSION: "1.69"
RUST_TOOLCHAIN_LINUX: "x86_64-unknown-linux-gnu"
steps:
- uses: actions/checkout@v3
with:
# Set to 0 to get full depth of repository cloned.
fetch-depth: 0
- name: Install Rust toolchain
run: |
set -eux
sudo apt update
sudo apt install curl
rustup default "$RUST_VERSION"
- name: Build
run: cargo build --release
- name: Run tests
run: cargo test --release
- name: Get release version
run: |
set -eux
# Get latest tag
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RELEASE_VERSION }}"
- name: Create tarball
run: |
set -eux
tarball="yambs_${RELEASE_VERSION}_${RUST_TOOLCHAIN_LINUX}.tar.gz"
tar -czf "$tarball" -C ./target/release yambs
echo "YAMBS_TARBALL=$tarball" >> "$GITHUB_ENV"
env:
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
- name: Create GitHub release
id: release
uses: softprops/[email protected]
with:
files: ${{ env.YAMBS_TARBALL }}
tag_name: ${{ env.RELEASE_VERSION }}