Skip to content

v1.9.1

v1.9.1 #16

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
APP_NAME: bilal
jobs:
create-github-release:
name: Create GitHub Release
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# it is a must!
fetch-depth: 0
- name: Set the release version
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
echo ${{ env.RELEASE_VERSION }}
- name: Checkout current tag
shell: bash
run: |
git checkout v${{ env.RELEASE_VERSION }}
- name: Generate a changelog
uses: orhun/git-cliff-action@v3
id: git-cliff
with:
config: configs/cliff.toml
args: -vv --strip header --current
env:
OUTPUT: CHANGELOG.md.tmp
- name: Print the changelog
run: cat "${{ steps.git-cliff.outputs.changelog }}"
- name: Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GH_TOKEN }}
name: "v${{ env.RELEASE_VERSION }}"
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
generate_release_notes: true
body_path: "${{ steps.git-cliff.outputs.changelog }}"
publish:
name: Publish
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { build: linux-gnu, os: ubuntu-22.04, target: x86_64-unknown-linux-gnu }
- { build: linux-musl, os: ubuntu-22.04, target: x86_64-unknown-linux-musl }
- { build: win-gnu, os: windows-2022, target: x86_64-pc-windows-gnu }
- { build: win-msvc, os: windows-2022, target: x86_64-pc-windows-msvc }
- { build: win32-msvc, os: windows-2022, target: i686-pc-windows-msvc }
- { build: macos, os: macos-12, target: x86_64-apple-darwin }
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set the release version
shell: bash
run: |
echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
echo ${{ env.RELEASE_VERSION }}
- name: Install musl-tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
--allow-unauthenticated musl-tools
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: Build
run: cargo build --release --locked --target ${{ matrix.target }}
- name: Build archive
shell: bash
run: |
outdir="./target/release"
staging="${{ env.APP_NAME }}-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
mkdir -p "$staging"/doc
cp -r {README.md,LICENSE*} "$staging/"
cp -r {CHANGELOG.md,docs/*} "$staging/doc/"
if [[ "${{ matrix.os }}" =~ ^windows-.*$ ]]; then
cp "target/${{ matrix.target }}/release/${{ env.APP_NAME }}.exe" "$staging/"
cd "$staging"
7z a "../$staging.zip" .
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
cp "target/${{ matrix.target }}/release/${{ env.APP_NAME }}" "$staging/"
tar czf "$staging.tar.gz" -C "$staging" .
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
- name: Release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GH_TOKEN }}
name: "v${{ env.RELEASE_VERSION }}"
files: ${{ env.ASSET }}
prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }}
generate_release_notes: false