coliru

A minimal, flexible, dotfile installer
git clone https://git.ashermorgan.net/coliru/
Log | Files | Refs | README

commit 5eccb6264094750bafca25f7af1fe22f97416807
parent 1a96fc9c592f6fb9e767d4f30f32fba6add4f5e7
Author: Asher Morgan <59518073+ashermorgan@users.noreply.github.com>
Date:   Sat,  6 Jul 2024 16:52:06 -0700

Add release workflow

Diffstat:
A.github/workflows/release.yml | 68++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 68 insertions(+), 0 deletions(-)

diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml @@ -0,0 +1,68 @@ +# Adapted from dzfrias.dev/blog/deploy-rust-cross-platform-github-actions + +name: Release + +on: + push: + tags: + - "[0-9]+.[0-9]+.[0-9]+" + +permissions: + contents: write + +jobs: + build-and-upload: + name: Build and upload + runs-on: ${{ matrix.os }} + + strategy: + matrix: + include: + - build: linux + os: ubuntu-latest + target: x86_64-unknown-linux-musl + - build: macos + os: macos-latest + target: x86_64-apple-darwin + - build: windows-gnu + os: windows-latest + target: x86_64-pc-windows-gnu + + steps: + - uses: actions/checkout@v3 + + - uses: dtolnay/rust-toolchain@stable + with: + targets: ${{ matrix.target }} + + - name: Parse version + shell: bash + run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV + + - name: Build binary + run: cargo build --verbose --release --target ${{ matrix.target }} + + - name: Create archive + shell: bash + run: | + dirname="coliru-${{ matrix.target }}" + mkdir "$dirname" + if [ "${{ matrix.os }}" = "windows-latest" ]; then + mv "target/${{ matrix.target }}/release/coliru.exe" "$dirname" + else + mv "target/${{ matrix.target }}/release/coliru" "$dirname" + fi + + if [ "${{ matrix.os }}" = "windows-latest" ]; then + 7z a "$dirname.zip" "$dirname" + echo "ASSET=$dirname.zip" >> $GITHUB_ENV + else + tar -czf "$dirname.tar.gz" "$dirname" + echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV + fi + + - name: Create release + uses: softprops/action-gh-release@v1 + with: + files: | + ${{ env.ASSET }}