-
Notifications
You must be signed in to change notification settings - Fork 43
143 lines (129 loc) · 4.88 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
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
139
140
141
142
143
name: "Release"
on:
push:
branches:
- release
jobs:
draft-release:
name: 'Draft Release'
runs-on: ubuntu-latest
outputs:
version: ${{ steps.make-release.outputs.version }}
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: 'Make release'
id: 'make-release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION=v$(cat package/version)
gh release create ${VERSION} \
--repo runtimeverification/haskell-backend \
--draft \
--title ${VERSION} \
--target ${{ github.sha }}
echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
release:
name: 'Release'
needs: draft-release
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Nix
uses: cachix/install-nix-action@v25
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
substituters = http://cache.nixos.org https://cache.iog.io
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
- name: Install Cachix
uses: cachix/cachix-action@v14
with:
name: k-framework
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'
- name: Build
run: nix build .#kore-exec .#kore-rpc-booster
ubuntu-package:
name: 'Build Ubuntu package'
needs: draft-release
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install prerequisites
run: |
sudo apt install --yes debhelper z3 libsecp256k1-dev
- name: Cache Stack root
uses: actions/cache@v4
with:
path: ~/.stack
key: stack-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}-${{ hashFiles('stack.yaml.lock') }}
restore-keys: |
stack-${{ runner.os }}-ghc-${{ env.ghc_version }}-${{ hashFiles('stack.yaml') }}
stack-${{ runner.os }}-ghc-${{ env.ghc_version }}
- uses: haskell-actions/[email protected]
id: setup-haskell-stack
with:
ghc-version: ${{ env.ghc_version }}
stack-version: ${{ env.stack_version }}
enable-stack: true
stack-setup-ghc: true
- name: Build Ubuntu package
run: ./package/debian/build-package jammy k-haskell-backend.deb
- name: 'Upload to release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION=v$(cat package/version)
cp k-haskell-backend.deb k-haskell-backend_${VERSION}_amd64_ubuntu_jammy.deb
gh release upload ${VERSION} \
--repo runtimeverification/haskell-backend \
--clobber \
k-haskell-backend_${VERSION}_amd64_ubuntu_jammy.deb
- name: 'On failure, delete drafted release'
if: failure()
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION=v$(cat package/version)
gh release delete ${VERSION} \
--repo runtimeverification/haskell-backend \
--yes \
--cleanup-tag
update-dependents:
name: 'Publish Release'
runs-on: ubuntu-latest
environment: production
needs: [draft-release, ubuntu-package, release]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VERSION: ${{ needs.draft-release.outputs.version }}
steps:
- name: 'Finalise release'
run: |
set -x
gh release edit ${VERSION} \
--repo runtimeverification/haskell-backend \
--draft=false
- name: 'Update dependents'
env:
GITHUB_TOKEN: ${{ secrets.JENKINS_GITHUB_PAT }}
run: |
set -x
curl --fail \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${GITHUB_TOKEN}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/runtimeverification/devops/dispatches \
-d '{"event_type":"on-demand-test","client_payload":{"repo":"runtimeverification/haskell-backend","version":"'${VERSION}'"}}'