Release witc artifacts #2
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 witc artifacts | |
on: | |
# Trigger the workflow on the new 'v*' tag created | |
push: | |
tags: ["v*"] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
get_version: | |
name: Retrieve version information | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.prep.outputs.version }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Ensure git safe directory | |
run: | | |
git config --global --add safe.directory $(pwd) | |
- name: Get version | |
id: prep | |
run: | | |
# Retrieve annotated tags. Details: https://github.com/actions/checkout/issues/290 | |
git fetch --tags --force | |
echo "Set version: $(git describe --match "[0-9].[0-9]*" --tag)" | |
echo "version=$(git describe --match '[0-9].[0-9]*' --tag)" >> $GITHUB_OUTPUT | |
create_release: | |
name: Create Github Release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: haskell/actions/setup@v2 | |
with: | |
ghc-version: "9.2.8" | |
- run: stack install --local-bin-path ./ | |
- name: Upload binary | |
uses: actions/upload-artifact@v3 | |
with: | |
name: witc | |
path: "witc" | |
- name: Get current date | |
id: date | |
run: echo "DATE=$(date +%Y-%m-%d-%H:%M)" >> $GITHUB_ENV | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: github.ref_type == 'tag' | |
with: | |
name: witc-${{ needs.get_version.outputs.version }}-ubuntu | |
files: witc |