chore: release 0.2.6 #14
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: | |
tags: | |
- "*" | |
jobs: | |
build: | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@master | |
- name: Cahce | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
restore-keys: ${{ runner.os }}-cargo- | |
- name: Install toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
override: true | |
toolchain: stable | |
target: ${{ matrix.target }} | |
- name: Build release | |
run: cd backend && cargo build --release | |
- name: Artifact (Unix) | |
if: matrix.target != 'x86_64-pc-windows-msvc' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: backend/target/release/mdbook-repl | |
- name: Artifact (Windows) | |
if: matrix.target == 'x86_64-pc-windows-msvc' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: backend/target/release/mdbook-repl.exe | |
- name: Publish crate | |
if: matrix.target == 'x86_64-unknown-linux-gnu' | |
run: | | |
cd backend | |
cargo login ${{ secrets.CARGO_TOKEN }} | |
cargo publish | |
release: | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Get the version | |
id: get_version | |
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} | |
- name: Install packages | |
run: sudo apt update && sudo apt install -y upx-ucl zip | |
- name: Rename binaries | |
run: | | |
mv x86_64-unknown-linux-gnu mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-gnu | |
mv x86_64-apple-darwin mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-apple-darwin | |
mv x86_64-pc-windows-msvc mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-pc-windows-msvc | |
- name: Compress binaries | |
run: | | |
chmod u+x mdbook-repl-*/mdbook-repl* | |
upx --best mdbook-repl-*/mdbook-repl* | |
zip -r mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-gnu{.zip,} | |
zip -r mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-apple-darwin{.zip,} | |
zip -r mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-pc-windows-msvc{.zip,} | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: v${{ steps.get_version.outputs.VERSION }} | |
files: | | |
mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-unknown-linux-gnu.zip | |
mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-apple-darwin.zip | |
mdbook-repl-${{ steps.get_version.outputs.VERSION }}-x86_64-pc-windows-msvc.zip |