-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (118 loc) · 4.28 KB
/
binary_release.yml
File metadata and controls
139 lines (118 loc) · 4.28 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Release
on:
# Trigger the workflow on the new 'v*' tag created
push:
tags:
- "v*"
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/create-release@v1.1.1
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.10.7"
# cabal: ["3.2"]
exclude:
- os: windows-latest
ghc: 8.8.3
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set tag name
uses: olegtarasov/get-tag@v2.1
id: tag
with:
tagRegex: "v(.*)"
tagRegexGroup: 1
# From https://raehik.github.io/2021/03/01/caching-stack-and-cabal-haskell-builds-on-github-actions.html
- name: Cache Haskell Stack files
uses: actions/cache@v2
with:
path: |
~/.stack
.stack-work
# best effort for cache: tie it to Stack resolver and package config
key: ${{ runner.os }}-stack-${{ hashFiles('stack.yaml.lock', 'package.yaml') }}
restore-keys: |
${{ runner.os }}-stack
- name: Setup Haskell
uses: haskell/actions/setup@v1
id: setup-haskell-cabal
with:
enable-stack: true
stack-no-global: true
# ghc-version: ${{ matrix.ghc }}
# cabal-version: 'latest'
stack-version: 'latest'
# - 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
stack build
find .stack-work/ -name libdiffprivhs.so -exec cp {} dist \;
# cabal install exe:stan --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"
run: echo "EXT=.exe" >> $GITHUB_ENV
- name: Set binary path name
# run: echo "::set-env name=BINARY_PATH::./dist/libdiffprivhs.so"
run: echo "BINARY_PATH=./dist/libdiffprivhs.so" >> $GITHUB_ENV
# run: echo "::set-env name=BINARY_PATH::./dist/libdiffprivhs.so${{ env.EXT }}"
# - name: Compress binary
# uses: svenstaro/upx-action@2.0.1
# 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 "upload_url=$(cat release_url/release_url.txt)" >> $GITHUB_ENV
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ${{ env.BINARY_PATH }}
asset_name: libdiffprivhs-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}.so
# asset_name: libdiffprivhs-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }}
asset_content_type: application/octet-stream