Skip to content

fixup! add release ci #16

fixup! add release ci

fixup! add release ci #16

Workflow file for this run

name: release
on:
push:
branches: [ci_release]
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: verify version matches
# shell: bash
# run: |
# grep -q 'version = "${{ github.ref_name }}"' Cargo.toml || {echo version mismatch >&2 && exit 1; }
# - name: create release
# run: gh release create ${{ github.ref_name }} --draft --verify-tag --title ${{ github.ref_name }}
build:
name: build
#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: ubuntu-latest
target: aarch64-unknown-linux-gnu
- 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: |
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: set archive name
shell: bash
run: |
version="${{ needs.create-release.outputs.version }}"
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: |
# version="${{ needs.create-release.outputs.version }}"
# gh release upload "$version" ${{ env.ASSET }}