This repository has been archived by the owner on Jul 27, 2022. It is now read-only.
-
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.
Fix workflow to properly build on tag push
- Loading branch information
1 parent
ae78ee4
commit ab5a77f
Showing
2 changed files
with
81 additions
and
18 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 |
---|---|---|
@@ -1,18 +1,28 @@ | ||
name: release | ||
on: | ||
push: | ||
branches: | ||
- refs/tags/* | ||
tags: ["v*"] | ||
|
||
jobs: | ||
release: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
- macOS-latest | ||
env: | ||
CONFIG: "--enable-tests --enable-benchmarks" | ||
create-release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- id: create-release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
- run: | | ||
echo "${{ steps.create-release.outputs.upload_url }}" > release_url.txt | ||
- uses: actions/[email protected] | ||
with: | ||
name: release_url | ||
path: release_url.txt | ||
|
||
compile-linux-binary: | ||
needs: create-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/[email protected] | ||
|
@@ -25,6 +35,57 @@ jobs: | |
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- run: | | ||
stack build --system-ghc --split-objs --flag gah:static --copy-bins | ||
# TODO add github release setup | ||
- name: Compile Linux Binary | ||
# Use ghc-musl to build a static binary against musl instead of glibc | ||
# NOTE: ghc883 needs to be changed to the GHC used in each Stack LTS | ||
run: | | ||
stack --docker --docker-image utdemir/ghc-musl:v13-libgmp-ghc883 build --split-objs --flag gah:static --copy-bins | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: release_url | ||
- id: get_release_info | ||
run: | | ||
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)" | ||
- name: Upload Linux binary | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | ||
asset_path: ./.stack-work/docker/_home/.local/bin/gah | ||
asset_name: gah-linux-amd64 | ||
asset_content_type: application/octet-stream | ||
|
||
compile-macOS-binary: | ||
needs: create-release | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/[email protected] | ||
with: | ||
enable-stack: true | ||
- uses: actions/cache@v2 | ||
with: | ||
path: | | ||
~/.stack | ||
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}- | ||
- name: Compile macOS binary | ||
run: | | ||
stack --system-ghc build --copy-bins | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
name: release_url | ||
- id: get_release_info | ||
run: | | ||
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)" | ||
- name: Upload Linux binary | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.get_release_info.outputs.upload_url }} | ||
asset_path: ~/.local/bin/gah | ||
asset_name: gah-macOS-amd64 | ||
asset_content_type: application/octet-stream |
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