Stan Release #36
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: Stan Release | |
on: | |
# Trigger the workflow on the new 'v*' tag created | |
push: | |
tags: | |
- "v*" | |
jobs: | |
create_release: | |
name: Create Github Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Create Release | |
id: create_release | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
prerelease: false | |
- name: Output Release URL File | |
run: echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt | |
- name: Save Release URL File for publish | |
uses: actions/upload-artifact@v3 | |
with: | |
name: release_url | |
path: release_url.txt | |
build_artifact: | |
needs: [create_release] | |
name: ${{ matrix.os }}/GHC ${{ matrix.ghc }}/${{ github.ref }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
# Don't fail fast because we test a lot of versions and it's | |
# good to know which ones work and which ones don't | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
ghc: | |
- "9.4.7" | |
cabal: ["3.8"] | |
steps: | |
- if: matrix.os == 'windows-latest' | |
name: Set binary path name on Windows | |
# https://stackoverflow.com/a/74547513/997606 | |
run: echo "BINARY_PATH=./dist/stan.exe" >> $env:GITHUB_ENV | |
- if: matrix.os != 'windows-latest' | |
name: Set binary path name not on Windows | |
run: echo "BINARY_PATH=./dist/stan" >> "$GITHUB_ENV" | |
- name: TEMPORARY show binary path name | |
run: | | |
echo "$BINARY_PATH" | |
echo $env:BINARY_PATH | |
- name: Compress binary | |
uses: svenstaro/[email protected] | |
with: | |
file: ${{ env.BINARY_PATH }} | |
- name: Load Release URL File from release job | |
uses: actions/download-artifact@v3 | |
with: | |
name: release_url | |
path: release_url | |
- name: Get Release File Name & Upload URL | |
id: get_release_info | |
run: | | |
echo "upload_url=$(cat release_url/release_url.txt)" >> $GITHUB_OUTPUT | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | |
asset_path: ${{ env.BINARY_PATH }} | |
asset_name: stan-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }} | |
asset_content_type: application/octet-stream |