This repository has been archived by the owner on Sep 18, 2024. It is now read-only.
Release #19
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: Release | |
on: | |
# Trigger the workflow on the new PVP version tag created. | |
# https://pvp.haskell.org/ | |
# See patterns explanation at: | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+.[0-9]+*" | |
jobs: | |
build-binaries: | |
name: Haskell-Release - ${{ matrix.os }} - ${{ matrix.ghc }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
# macos-13 points to x64 based OS and mocos-latest points to arm based OS | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- macos-13 | |
cabal: | |
- 3.12.1.0 | |
ghc: | |
- 9.8.2 | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- uses: haskell-actions/setup@v2 | |
id: setup-haskell-cabal | |
name: Setup Haskell | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- name: Freeze | |
run: cabal freeze | |
- name: cache | |
uses: actions/cache@v4 | |
with: | |
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} | |
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} | |
restore-keys: | | |
${{ runner.os }}-${{ matrix.ghc }}- | |
- name: Zip data directory | |
run: zip -r swarm-data.zip ./data || { echo "Unable to create a zip archive."; exit 1; } | |
- name: Set binary path name | |
run: echo BINARY_PATH="./dist/swarm" >> "$GITHUB_ENV" | |
- name: Set binary OS name | |
run: echo BINARY_OS=${{ runner.os }} >> "$GITHUB_ENV" | |
- if: (matrix.os == 'macos-13') || (matrix.os == 'macos-latest') | |
name: Set binary OS name on Macos | |
run: echo BINARY_OS="Darwin" >> "$GITHUB_ENV" | |
- name: Set binary Arch name | |
run: echo ARCH="x86_64" >> "$GITHUB_ENV" | |
- if: matrix.os == 'macos-latest' | |
name: Set binary ARCH name for apple silicon | |
run: echo ARCH="arm64" >> "$GITHUB_ENV" | |
- name: Install dependencies | |
run: cabal v2-build --disable-tests --disable-benchmarks --dependencies-only -j2 all | |
- name: Build binary | |
run: | | |
mkdir dist | |
cabal v2-install exe:swarm --install-method=copy --overwrite-policy=always --installdir=dist | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: swarm-${{ env.BINARY_OS }}-${{env.ARCH}} | |
path: ${{ env.BINARY_PATH }} | |
retention-days: 3 | |
create-release: | |
name: Create release | |
needs: [build-binaries] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Download Linux x86_64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: swarm-Linux-x86_64 | |
path: artifacts/swarm-Linux-x86_64 | |
- name: Download executable for Macos x86_64 | |
uses: actions/download-artifact@v4 | |
with: | |
name: swarm-Darwin-x86_64 | |
path: artifacts/swarm-Darwin-x86_64 | |
- name: Download executable for arm64 Macos | |
uses: actions/download-artifact@v4 | |
with: | |
name: swarm-Darwin-arm64 | |
path: artifacts/swarm-Darwin-arm64 | |
- name: Rename executables | |
run: | | |
mv artifacts/swarm-Linux-x86_64/swarm swarm-Linux-x86_64 | |
mv artifacts/swarm-Darwin-x86_64/swarm swarm-Darwin-x86_64 | |
mv artifacts/swarm-Darwin-arm64/swarm swarm-Darwin-arm64 | |
- name: Upload Release Asset | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: swarm | |
draft: false | |
prerelease: false | |
files: | | |
swarm-Linux-x86_64 | |
swarm-Darwin-x86_64 | |
swarm-Darwin-arm64 | |
LICENSE | |
swarm-data.zip | |
# - name: Generate tarball for Hackage | |
# run: cabal v2-sdist | |
# - name: Generate documentation for Hackage | |
# # The hackage-server attempts to build documentation for library packages, but this can fail. | |
# # If it does we can do it ourselves | |
# run: cabal v2-haddock --builddir=docs --haddock-for-hackage --enable-doc | |
# - uses: haskell-actions/hackage-publish@v1 | |
# with: | |
# hackageToken: "${{ secrets.HACKAGE_AUTH_TOKEN }}" | |
# packagesPath: dist-newstyle/sdist | |
# # docsPath: docs | |
# publish: true |