actions/setup-haskell #9
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: Build and Release | |
on: | |
push: | |
tags: | |
- 'v*.*.*.*' # Trigger on version tags (e.g., v1.0.0) | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Haskell Stack | |
uses: actions/[email protected] | |
with: | |
ghc-version: '9.4' # chose compatible with stack env | |
cabal-version: '3.12' # chose compatible with stack env | |
- name: Build executable | |
run: stack build --copy-bins | |
env: | |
STACK_ROOT: ${{ runner.temp }}/stack-root | |
HOME: ${{ runner.temp }} | |
- name: Run tests | |
run: stack test | |
env: | |
STACK_ROOT: ${{ runner.temp }}/stack-root | |
HOME: ${{ runner.temp }} | |
- name: Package executable | |
run: | | |
mkdir -p dist | |
cp $(stack path --local-install-root)/bin/chunktool* dist/ | |
env: | |
STACK_ROOT: ${{ runner.temp }}/stack-root | |
HOME: ${{ runner.temp }} | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: chunktool-${{ matrix.os }} | |
path: dist/ | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Download built artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: chunktool-ubuntu-latest | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: dist/* | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |