-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
104 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: Release | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
create_release: | ||
name: Create Github Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- 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@v1 | ||
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: | ||
matrix: | ||
os: [ubuntu-latest, macOS-latest, windows-latest] | ||
ghc: | ||
- "8.8.3" | ||
- "8.10.1" | ||
cabal: ["3.2"] | ||
exclude: | ||
- os: windows-latest | ||
ghc: 8.8.3 | ||
|
||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Haskell | ||
uses: actions/[email protected] | ||
id: setup-haskell-cabal | ||
with: | ||
ghc-version: ${{ matrix.ghc }} | ||
cabal-version: ${{ matrix.cabal }} | ||
|
||
- name: Freeze | ||
run: | | ||
cabal freeze | ||
- name: Cache ~/.cabal/store | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} | ||
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }} | ||
|
||
- name: Build binary | ||
run: | | ||
mkdir dist | ||
cabal install exe:indigo --install-method=copy --overwrite-policy=always --installdir=dist | ||
- if: matrix.os == 'windows-latest' | ||
name: Set extension to .exe on Windows | ||
run: echo "::set-env name=EXT::.exe" | ||
|
||
- name: Set binary path name | ||
run: echo "::set-env name=BINARY_PATH::./dist/indigo${{ env.EXT }}" | ||
|
||
- name: Compress binary | ||
uses: svenstaro/[email protected] | ||
with: | ||
file: ${{ env.BINARY_PATH }} | ||
|
||
- name: Load Release URL File from release job | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: release_url | ||
|
||
- name: Get Release File Name & Upload URL | ||
id: get_release_info | ||
run: | | ||
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)" | ||
- 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: indigo-HEAD-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }} | ||
asset_content_type: application/octet-stream |