Skip to content

ci: add release action #7

ci: add release action

ci: add release action #7

Workflow file for this run

name: release
on:
push:
tags:
- "*"
workflow_dispatch:
jobs:
build:
name: ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
include:
- target: x86_64-pc-windows-gnu
- target: x86_64-unknown-linux-musl
- target: x86_64-apple-darwin
steps:
- uses: actions/checkout@master
- uses: actions-rs/toolchain@v1
with:
override: true
toolchain: stable
target: ${{ matrix.target }}
- name: Build binary
run: |
cargo build --release --target ${{ matrix.target }}
if [ ${{ matrix.target }} == 'x86_64-pc-windows-gnu' ]; then
mkdir bin && mv target/${{ matrix.target }}/release/mdbook-embedify.exe bin
mv bin/mdbook-embedify.exe bin/mdbook-embedify-${{ github.ref }}-${{ matrix.target }}.exe
else
mkdir bin && mv target/${{ matrix.target }}/release/mdbook-embedify bin
mv bin/mdbook-embedify bin/mdbook-embedify-${{ github.ref }}-${{ matrix.target }}
fi
- uses: actions/upload-artifact@v3
with:
name: bin
path: bin/*
release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v2
- name: Install packages
run: sudo apt-get update && sudo apt-get install -y upx-ucl
- name: Compress binaries
run: upx --best bin/* && ls -lh bin
# - name: Create release
# uses: softprops/action-gh-release@v1.15
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# files: bin/*
# tag_name: ${{ github.ref }}
# draft: true
# prerelease: true