-
Notifications
You must be signed in to change notification settings - Fork 97
84 lines (76 loc) · 2.25 KB
/
haskell.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
name: Haskell
on:
workflow_dispatch:
push:
branches:
- master
- staging
tags:
- "*"
pull_request:
paths:
- "haskell/**"
- .github/workflows/haskell.yaml
jobs:
build:
name: Build
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
name: Cache ~/.stack
with:
path: ~/.stack
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-
- uses: actions/cache@v4
name: Cache .stack-work
with:
path: .stack-work
key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }}
restore-keys: |
${{ runner.os }}-stack-work-
- uses: haskell/actions/setup@v1
with:
enable-stack: true
- name: Build binaries
id: build
working-directory: ./haskell
run: |
VERSION="$(git describe --always --tags --dirty)"
BUILD_TRIPLET="$(cc -dumpmachine)"
ARTIFACT_NAME="sbp_tools_haskell-${VERSION}-${BUILD_TRIPLET}.zip"
mkdir ./bins
stack install --local-bin-path ./bins
cd ./bins
zip ../$ARTIFACT_NAME \
sbp2json \
sbp2prettyjson \
sbp2yaml \
json2sbp \
json2json \
sbp2nmea
echo "::set-output name=artifact_name::$ARTIFACT_NAME"
- uses: actions/upload-artifact@v4
with:
name: ${{ steps.build.outputs.artifact_name }}
path: ./haskell/${{ steps.build.outputs.artifact_name }}
publish:
if: startsWith(github.ref, 'refs/tags/v')
needs: [build]
name: Publish github release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: artifacts
- name: Upload Release
uses: svenstaro/upload-release-action@v1-release
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: "artifacts/*/*.zip"
tag: ${{ github.ref }}
overwrite: true
file_glob: true