-
Notifications
You must be signed in to change notification settings - Fork 8
80 lines (77 loc) · 2.54 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
name: Release
on:
push:
tags:
- "v*"
jobs:
create_release:
name: Create Github Release
runs-on: ubuntu-20.04
steps:
- name: Check out code
uses: actions/checkout@v3
- 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: false
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: Build Artifact
strategy:
matrix:
os: [ubuntu-20.04, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- if: matrix.os == 'ubuntu-20.04'
uses: actions/cache@v3
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-stack-${{ hashFiles('**/stack.yaml.lock') }}-${{ hashFiles('**/package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-${{ hashFiles('**/stack.yaml.lock') }}-
${{ runner.os }}-stack-
- uses: haskell/actions/setup@v2
with:
ghc-version: "9.4.6"
enable-stack: true
stack-version: "latest"
- if: matrix.os == 'ubuntu-20.04'
name: Build binary (linux/static)
run: stack install --local-bin-path dist --flag git-brunch:static
- if: matrix.os == 'macos-latest'
name: Build binary (macos/dynamic)
run: stack install --local-bin-path dist
- 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: |
value=`cat release_url/release_url.txt`
echo ::set-output name=upload_url::$value
- 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: ./dist/git-brunch
asset_name: git-brunch-${{ runner.os }}
asset_content_type: application/octet-stream