Skip to content

Update release workflow. #21

Update release workflow.

Update release workflow. #21

Workflow file for this run

name: 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
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Wait for tests to succeed
uses: lewagon/wait-on-check-action@v1.3.4
with:
ref: ${{ github.ref }}
check-regexp: '^Haskell-CI.*$'
repo-token: ${{ secrets.GITHUB_TOKEN }}
wait-interval: 10
- name: Check out code
uses: actions/checkout@v3
- 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:
- 8.10.7
cabal: ["3.6.2.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:cabal-prettify --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_PATH=./dist/cabal-prettify${{ env.EXT }}" >> $GITHUB_ENV
- name: Compress binary
uses: svenstaro/upx-action@v2
with:
file: ${{ env.BINARY_PATH }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: ${{ env.BINARY_PATH }}
asset_name: cabal-prettify-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }}
asset_content_type: application/octet-stream