fixup! tmp: always run release action #26
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 | |
permissions: | |
contents: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
create: | |
name: create release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: create release | |
run: gh release create ${{ github.ref_name }} --draft --verify-tag --title ${{ github.ref_name }} | |
build_bin: | |
name: build binary | |
needs: ['create'] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
target: x86_64-unknown-linux-gnu | |
- os: ubuntu-latest | |
target: i686-unknown-linux-musl | |
- os: macos-latest | |
target: x86_64-apple-darwin | |
- os: macos-latest | |
target: aarch64-apple-darwin | |
- os: windows-latest | |
target: x86_64-pc-windows-msvc | |
- os: windows-latest | |
target: i686-pc-windows-msvc | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: install rust | |
shell: bash | |
run: | | |
rustup update stable | |
rustup target add ${{ matrix.target }} | |
- name: build | |
shell: bash | |
run: | | |
if [ -n "${{ matrix.linker }}" ]; then | |
export RUSTFLAGS="-Clinker=${{ matrix.linker }}" | |
fi | |
cargo build --verbose --release --target ${{ matrix.target }} | |
find . | |
bin="target/${{ matrix.target }}/release/jotdown" | |
[ "${{ matrix.os }}" = "windows-latest" ] && bin="$bin.exe" | |
echo "BIN=$bin" >> $GITHUB_ENV | |
- name: strip | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: strip $BIN | |
- name: set archive name | |
shell: bash | |
run: echo "ARCHIVE=jotdown-${{ github.ref_name }}-${{ matrix.target }}" >> $GITHUB_ENV | |
- name: init archive dir | |
shell: bash | |
run: | | |
mkdir "$ARCHIVE"/ | |
cp "$BIN" "$ARCHIVE"/ | |
cp {COPYING,CHANGELOG.md,README.md} "$ARCHIVE"/ | |
- name: archive (win) | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
shell: bash | |
run: | | |
7z a "$ARCHIVE.zip" "$ARCHIVE" | |
echo "ASSET=$ARCHIVE.zip" >> $GITHUB_ENV | |
- name: archive (unix) | |
if: ${{ ! startsWith(matrix.os, 'windows') }} | |
shell: bash | |
run: | | |
tar czf "$ARCHIVE.tar.gz" "$ARCHIVE" | |
echo "ASSET=$ARCHIVE.tar.gz" >> $GITHUB_ENV | |
- name: Upload release archive | |
shell: bash | |
run: | | |
gh release upload ${{ github.ref_name }} ${{ env.ASSET }} | |
build_wasm: | |
name: build wasm lib | |
needs: ['create'] | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref_name }} | |
- name: install toolchain | |
shell: bash | |
run: | | |
rustup update stable | |
rustup target add ${{ matrix.target }} | |
cargo install wasm-pack | |
- name: build | |
shell: bash | |
run: | | |
cd examples/jotdown_wasm && make wasm | |
- name: upload | |
shell: bash | |
run: | | |
gh release upload ${{ github.ref_name }} examples/jotdown_wasm/pkg/jotdown_wasm_bg.wasm | |
gh release upload ${{ github.ref_name }} examples/jotdown_wasm/pkg/jotdown_wasm.js |