-
Notifications
You must be signed in to change notification settings - Fork 1
91 lines (88 loc) · 2.93 KB
/
build.yaml
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
81
82
83
84
85
86
87
88
89
90
91
name: release
on:
push:
tags: ["v*"]
jobs:
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]
with:
enable-stack: true
- uses: actions/cache@v2
with:
path: |
~/.stack
key: ${{ runner.os }}-${{ hashFiles('stack.yaml.lock') }}
restore-keys: |
${{ runner.os }}-
- 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 build --ghc-options ' -static -optl-static -optl-pthread -fPIC' --docker --docker-image "utdemir/ghc-musl:v19-ghc8104" --no-nix
- 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/pacrd-migrate
asset_name: pacrd-migrate-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/pacrd-migrate
asset_name: pacrd-migrate-macOS-amd64
asset_content_type: application/octet-stream