-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
configure release flow in GitHub Actions
- Loading branch information
Showing
1 changed file
with
100 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,100 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
jobs: | ||
|
||
build: | ||
strategy: | ||
matrix: | ||
target: | ||
- linux | ||
- darwin | ||
include: | ||
- target: linux | ||
os: ubuntu-latest | ||
- target: darwin | ||
os: macos-latest | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@master | ||
- name: Install stack | ||
run: | | ||
command -v stack || curl -sSL https://get.haskellstack.org/ | sh | ||
- name: Build | ||
run: stack build | ||
- name: Install | ||
run: stack install | ||
- name: Build artifact | ||
run: | | ||
export name="miv_$TARGET" | ||
export PATH=$PATH:~/.local/bin | ||
mkdir "$name" | ||
cp README.md LICENSE _miv "$name" | ||
mv "$(which miv)" "$name" | ||
zip -r "$name.zip" "$name" | ||
env: | ||
TARGET: ${{ matrix.target }} | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: ${{ matrix.target }} | ||
path: miv_${{ matrix.target }}.zip | ||
|
||
create-release: | ||
needs: [build] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create release | ||
id: create-release | ||
uses: actions/create-release@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
- name: Save release upload url | ||
run: | | ||
echo '${{ steps.create-release.outputs.upload_url }}' > release_upload_url.txt | ||
- name: Upload release upload url | ||
uses: actions/upload-artifact@master | ||
with: | ||
name: create-release | ||
path: release_upload_url.txt | ||
|
||
upload-release: | ||
strategy: | ||
matrix: | ||
target: | ||
- linux | ||
- darwin | ||
needs: [create-release] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Download release upload url | ||
uses: actions/download-artifact@master | ||
with: | ||
name: create-release | ||
- name: Set upload url | ||
id: upload-url | ||
run: | | ||
echo "::set-output name=url::$(cat create-release/release_upload_url.txt)" | ||
- name: Download artifact | ||
uses: actions/download-artifact@master | ||
with: | ||
name: ${{ matrix.target }} | ||
- name: Upload release artifact | ||
uses: actions/upload-release-asset@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.upload-url.outputs.url }} | ||
asset_path: ${{ matrix.target }}/miv_${{ matrix.target }}.zip | ||
asset_name: miv_${{ matrix.target }}.zip | ||
asset_content_type: application/zip |