Skip to content

closes #21

closes #21 #10

Workflow file for this run

name: release
on:
push:
branches:
- main
tags:
- v*.*.*
workflow_dispatch:
jobs:
build:
strategy:
matrix:
include:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-20.04, suffix: .gz }
- { target: x86_64-apple-darwin, os: macos-latest, suffix: .gz }
- { target: x86_64-pc-windows-msvc, os: windows-latest, suffix: .zip }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
target: ${{ matrix.target }}
override: true
- name: Cache Dependencies
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --target ${{ matrix.target }} --release
- name: (Not Windows) Move executables and compress
if: ${{ matrix.os != 'windows-latest' }}
run: gzip -c target/${{ matrix.target }}/release/form > form-${{ matrix.target }}${{ matrix.suffix }}
- name: (Windows) Move executables and compress
if: ${{ matrix.os == 'windows-latest' }}
run: Compress-Archive -Path target\${{ matrix.target }}\release\form.exe -DestinationPath form-${{ matrix.target }}${{ matrix.suffix }}
- uses: actions/upload-artifact@v3
with:
name: form-${{ matrix.target }}
path: form-${{ matrix.target }}${{ matrix.suffix }}
release:
name: release
runs-on: ubuntu-latest
needs: [build]
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
path: artifacts
- run: ls -R ./artifacts
- name: Set current date as environment variable
run: echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- id: changelog-reader
uses: mindsers/[email protected]
with:
version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }}
- uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.changelog-reader.outputs.version }}
name: ${{ (github.ref_type == 'tag' && steps.changelog-reader.outputs.version) || format('Prereleased {0}', env.CURRENT_DATE) }}
body: ${{ steps.changelog-reader.outputs.changes }}
prerelease: ${{ steps.changelog-reader.outputs.status == 'unreleased' }}
token: ${{ secrets.GITHUB_TOKEN }}
files: |
artifacts/**/*