Skip to content

[Release] v0.1.5

[Release] v0.1.5 #36

Workflow file for this run

# from: https://faun.pub/automate-your-build-release-with-github-actions-367c0febf5fd
name: Release CI
on:
push:
branches: ["main"]
jobs:
deploy:
# A strategy is used to define various build environments this job will run.
#
# To say it simple, this will create 3 separate independent jobs which will
# run on ubuntu, mac & windows.
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.os }}
# Runs when the commit message contains "[Release]"
if: "contains(github.event.head_commit.message, '[Release]')"
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Build
run: cargo build --release
# Condition to only run this whenever the runner os is Mac
- name: Build Release Mac
if: matrix.os == 'macos-latest'
run: |
strip target/release/mdbook-theme
strip target/release/mdbook-theme-ace
mkdir -p release
# Condition to only run this whenever the runner os is Ubuntu
- name: Build Release Linux
if: matrix.os == 'ubuntu-latest'
run: |
strip target/release/mdbook-theme
strip target/release/mdbook-theme-ace
mkdir -p release
- name: UPX on Ubuntu
# not support on mac
if: matrix.os == 'ubuntu-latest'
uses: crazy-max/ghaction-upx@v3
with:
version: latest
files: |
target/release/mdbook-theme
target/release/mdbook-theme-ace
args: -fq
- name: Tar on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: tar -C ./target/release/ -czvf ./release/mdbook-theme_linux.tar.gz ./mdbook-theme ./mdbook-theme-ace
- name: Tar on Mac
if: matrix.os == 'macos-latest'
run: tar -C ./target/release/ -czvf ./release/mdbook-theme_mac.tar.gz ./mdbook-theme ./mdbook-theme-ace
# Condition to only run this whenever the runner os is Windows
- name: Build Release Win
if: matrix.os == 'windows-latest'
run: |
mkdir -p release
tar -C ./target/release/ -czvf ./release/mdbook-theme_win.tar.gz ./mdbook-theme.exe ./mdbook-theme-ace.exe
- name: UPX on Win
if: matrix.os == 'windows-latest'
uses: crazy-max/ghaction-upx@v3
with:
version: latest
files: |
target/release/*.exe
args: -fq
- name: Tar on win
if: matrix.os == 'windows-latest'
run: tar -C ./target/release/ -czvf ./release/mdbook-theme_win.tar.gz ./mdbook-theme.exe ./mdbook-theme-ace.exe
# This will draft a new release & will attach the binaries produced by the above outputs.
# You still need to publish this release though after job ends.
- name: Release
uses: softprops/action-gh-release@v2
with:
draft: true
files: |
./release/*.tar.gz
./release/*.zip
./release/*.deb