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
on: ['push'] | |
jobs: | |
build: | |
name: Build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macOS-latest] | |
ghc: ["9.4.8"] | |
steps: | |
- run: echo "$HOME/.local/bin" >> $GITHUB_PATH | |
- if: matrix.os == 'macOS-latest' | |
run: 'brew install pkg-config' | |
- run: 'echo version=${GITHUB_REF#refs/tags/} >>$GITHUB_OUTPUT' | |
id: get_version | |
- uses: actions/checkout@v4 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.stack | |
key: "${{ runner.os }}-${{ matrix.ghc }}-v8-${{ hashFiles('patat.cabal', 'stack.yaml', 'stack.yaml.lock') }}" | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.ghc }}-v8- | |
- uses: haskell-actions/setup@v2 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
enable-stack: true | |
stack-version: 'latest' | |
stack-no-global: true | |
stack-setup-ghc: true | |
- run: make build | |
id: build | |
- run: make test | |
- if: startsWith(github.ref, 'refs/tags') | |
run: make artifact | |
env: | |
PATAT_TAG: ${{ steps.get_version.outputs.version }} | |
- uses: actions/upload-artifact@v4 | |
if: startsWith(github.ref, 'refs/tags') | |
with: | |
path: artifacts/* | |
name: artifacts-${{ runner.os }}-${{ matrix.ghc }} | |
release: | |
name: Release | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags') | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: artifacts-* | |
- run: ls -R | |
- run: 'sha256sum artifacts-*/patat-*' | |
- uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: 'artifacts-*/patat-*' |