-
Notifications
You must be signed in to change notification settings - Fork 24
145 lines (132 loc) · 4.7 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
144
145
name: 'Master Push'
on:
push:
branches:
- master
jobs:
draft-release:
name: 'Draft Release'
runs-on: ubuntu-latest
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: 'Make release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION=v$(cat package/version)
gh release create ${VERSION} \
--repo runtimeverification/llvm-backend \
--draft \
--title ${VERSION} \
--target ${{ github.sha }}
build-ubuntu-package:
name: 'Build Ubuntu package'
runs-on: [self-hosted, linux, normal]
needs: draft-release
strategy:
matrix:
include:
- distro: jammy
llvm: 15
- distro: noble
llvm: 17
steps:
- uses: actions/checkout@v4
- name: 'Check out code'
uses: actions/checkout@v4
with:
path: k-llvm-${{ matrix.distro }}
submodules: recursive
- name: 'Build package in Docker'
uses: ./.github/actions/test-package
with:
os: ubuntu
distro: ${{ matrix.distro }}
llvm: ${{ matrix.llvm }}
build-package: package/debian/build-package ${{ matrix.distro }}
test-package: package/debian/test-package
pkg-name: k-llvm-backend_amd64_ubuntu_${{ matrix.distro }}.deb
- name: 'Upload to release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION=v$(cat package/version)
cp k-llvm-backend_amd64_ubuntu_${{ matrix.distro }}.deb k-llvm-backend_${VERSION}_amd64_ubuntu_${{ matrix.distro }}.deb
gh release upload ${VERSION} \
--repo runtimeverification/llvm-backend \
--clobber \
k-llvm-backend_${VERSION}_amd64_ubuntu_${{ matrix.distro }}.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/llvm-backend \
--yes \
--cleanup-tag
cachix:
name: 'Publish to Cachix'
strategy:
fail-fast: false
matrix:
include:
- runner: [self-hosted, linux, normal]
os: ubuntu-24.04
- runner: [self-hosted, self-macos-latest]
os: self-macos-latest
runs-on: ${{ matrix.runner }}
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: 'Install Nix'
if: ${{ !startsWith(matrix.os, 'self') }}
uses: cachix/install-nix-action@v22
with:
install_url: https://releases.nixos.org/nix/nix-2.13.3/install
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: 'Install Cachix'
uses: cachix/cachix-action@v12
with:
name: k-framework
authToken: '${{ secrets.CACHIX_PUBLIC_TOKEN }}'
skipPush: true
- name: 'Push Flake to Cachix'
run: |
GC_DONT_GC=1 nix build --print-build-logs . --json \
| jq -r '.[].outputs | to_entries[].value' \
| cachix push k-framework
release:
name: 'Publish Release'
runs-on: ubuntu-latest
environment: production
needs: [build-ubuntu-package, cachix]
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: 'Finalise release'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -x
VERSION=v$(cat package/version)
gh release edit ${VERSION} --draft=false
- name: 'Update dependents'
env:
GITHUB_TOKEN: ${{ secrets.JENKINS_GITHUB_PAT }}
run: |
set -x
VERSION=$(cat package/version)
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/llvm-backend","version":"'${VERSION}'"}}'