forked from kind2-mc/kind2
-
Notifications
You must be signed in to change notification settings - Fork 1
137 lines (120 loc) · 3.72 KB
/
kind2-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
name: Kind 2 Release
on:
workflow_dispatch:
# Run the nightly build at 8 AM UTC / 2 AM Central
schedule:
- cron: "0 8 * * *"
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*'
jobs:
get-nightly-ready:
if: github.repository == 'kind2-mc/kind2' && !startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Delete old assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ids=$(gh release view nightly --json assets --jq '.assets | map(.name) | .[]')
for id in $ids;
do
gh release delete-asset nightly $id -y
done
- name: Update nightly tag
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git tag -f nightly
git push --tags -f
create-new-release:
if: github.repository == 'kind2-mc/kind2' && startsWith(github.event.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Create new release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
cat > Release_Notes.txt << EOF
TODO:
- Generate and upload user_documentation.pdf
- Replace this text with the release notes
- Publish the release!"
EOF
gh release create $GITHUB_REF_NAME --verify-tag --draft \
--title "Kind 2 $GITHUB_REF_NAME" --notes-file Release_Notes.txt \
--repo $GITHUB_REPOSITORY
build:
if: |
always()
&& github.repository == 'kind2-mc/kind2'
&& contains(needs.*.result, 'success')
&& !contains(needs.*.result, 'failure')
needs: [get-nightly-ready, create-new-release]
strategy:
matrix:
os: [ ubuntu-latest, macos-13, macos-14 ]
ocaml-version: [ 5.1.1 ]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build Kind 2 linux binary
if: runner.os == 'Linux'
uses: docker/build-push-action@v5
with:
file: docker/Dockerfile
context: ./
target: builder
load: true
tags: kind2:latest
- name: Extract Kind 2 linux binary
id: extract
if: runner.os == 'Linux'
uses: shrink/actions-docker-extract@v3
with:
image: kind2:latest
path: /home/opam/kind2-build/bin/kind2
destination: ./bin/
- name: Update package information (macOS)
if: runner.os == 'macOS'
run: brew update
- name: Build Kind 2 macOS binary
if: runner.os == 'macOS'
uses: ./.github/actions/build-kind2
with:
ocaml-version: ${{ matrix.ocaml-version }}
flambda: true
- name: Strip Kind 2 macOS binary
if: runner.os == 'macOS'
run: strip ./bin/kind2
- name: Create asset
id: create_asset
run: |
cd bin
chmod u+x kind2
if [[ "$GITHUB_REF" =~ ^refs/tags/v.* ]]; then
vtag=$GITHUB_REF_NAME
echo "release=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT
else
vtag=$(date "+%Y-%m-%d")
echo "release=nightly" >> $GITHUB_OUTPUT
fi
if [[ "$RUNNER_OS" == "Linux" ]]; then
ptag="linux-x86_64"
else
ptag="${{ matrix.os }}-$(uname -m)"
fi
tarball=kind2-$vtag-$ptag.tar.gz
tar -czf $tarball kind2
echo "filepath=./bin/$tarball" >> $GITHUB_OUTPUT
- name: Upload release asset
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.create_asset.outputs.release }} \
${{ steps.create_asset.outputs.filepath }} \
--repo $GITHUB_REPOSITORY