test release action #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: srtols Release | |
on: push | |
# Trigger the workflow on the new 'v*' tag created | |
#push: | |
# tags: | |
# - "v*" | |
jobs: | |
create_release: | |
name: Create Github Release | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1.1.4 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: true | |
prerelease: false | |
build_artifact: | |
needs: [create_release] | |
name: ${{ matrix.os }}/GHC ${{ matrix.ghc }}/${{ github.ref }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macOS-latest, windows-latest] | |
ghc: | |
- 9.6.6 | |
cabal: ["3.12.1.0"] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Set tag name | |
uses: olegtarasov/get-tag@v2.1 | |
id: tag | |
with: | |
tagRegex: "v(.*)" | |
tagRegexGroup: 1 | |
- name: Setup Haskell | |
uses: haskell/actions/setup@v2 | |
id: setup-haskell-cabal | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
- name: Cache ~/.cabal/store | |
uses: actions/cache@v2 | |
with: | |
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ github.sha }} | |
path: ~/.cabal/store | |
- name: Build binary | |
run: | | |
mkdir dist | |
cabal install exe:srsimplify --install-method=copy --overwrite-policy=always --installdir=dist | |
cabal install exe:srtools --install-method=copy --overwrite-policy=always --installdir=dist | |
- if: matrix.os == 'windows-latest' | |
name: Set extension to .exe on Windows | |
run: echo "EXT=.exe" >> $GITHUB_ENV | |
- name: Set binary path name | |
run: | | |
echo "BINARY_PATH1=./dist/srsimplify${{ env.EXT }}" >> $GITHUB_ENV | |
echo "BINARY_PATH2=./dist/srtools${{ env.EXT }}" >> $GITHUB_ENV | |
- name: Compress binary | |
uses: svenstaro/upx-action@2.0.1 | |
with: | |
file: ${{ env.BINARY_PATH }} | |
- name: Upload Release Asset | |
id: upload-release-asset | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: | | |
${{ env.BINARY_PATH1 }}/srsimplify-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }} | |
${{ env.BINARY_PATH2 }}/srtools-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }} |