Skip to content

Commit c7f25b0

Browse files
committed
adding nightly builds and shasum
1 parent 5fd36dd commit c7f25b0

File tree

1 file changed

+93
-26
lines changed

1 file changed

+93
-26
lines changed

.github/workflows/release.yml

Lines changed: 93 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ name: "Wrap releases"
99

1010
on:
1111
workflow_dispatch:
12-
pull_request:
12+
inputs:
13+
tag_name:
14+
description: 'Tag name for release'
15+
required: false
16+
default: nightly
1317
push:
1418
tags:
1519
- v[1-9]+.[0-9]+.[0-9] # allow v1.2.3
1620
- v[1-9]+.[0-9]+.[0-9]-* # allow v1.2.3-beta3 etc.
17-
branches:
18-
- main
19-
- flint-*
2021
schedule:
2122
# Every day at 3:33 AM UTC
2223
- cron: '33 3 * * *'
@@ -29,19 +30,27 @@ concurrency:
2930
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}
3031

3132
jobs:
32-
make-archive:
33+
version_and_tag:
3334
runs-on: ubuntu-latest
3435
outputs:
35-
get-version: ${{ steps.get-version.outputs.version }}
36+
version: ${{ steps.get-version.outputs.version }}
37+
tag_name: ${{ steps.get-tag_name.outputs.tag_name }}
3638

3739
steps:
3840
- uses: actions/checkout@v4
39-
40-
- name: "Setup"
41+
# figure out TAG_NAME
42+
- if: github.event_name == 'push'
4143
run: |
42-
sudo apt-get install -y autoconf libtool-bin
43-
autoconf --version
44-
libtool --version
44+
TAG_NAME=${{ github.ref }}
45+
echo "TAG_NAME=${TAG_NAME#refs/tags/}" >> $GITHUB_ENV
46+
- if: github.event_name == 'workflow_dispatch'
47+
run: echo "TAG_NAME=${{ github.event.inputs.tag_name }}" >> $GITHUB_ENV
48+
- if: github.event_name == 'schedule'
49+
run: echo 'TAG_NAME=nightly' >> $GITHUB_ENV
50+
- id: get-tag_name
51+
run: |
52+
echo "tag_name=${TAG_NAME}"
53+
echo "tag_name=${TAG_NAME}" >> $GITHUB_OUTPUT
4554
4655
- name: "Record FLINT version"
4756
id: get-version
@@ -52,30 +61,51 @@ jobs:
5261
version=${GITHUB_REF#refs/tags/v}
5362
else
5463
version=$(cat VERSION)
64+
if [ ${TAG_NAME} = "nightly" ] ; then
65+
version=${version}-$(date +"%Y%M%d")
66+
fi
5567
fi
5668
echo "version=${version}"
5769
echo "version=${version}" >> $GITHUB_OUTPUT
5870
71+
72+
make-archive:
73+
runs-on: ubuntu-latest
74+
needs: version_and_tag
75+
env:
76+
FLINT_VERSION: ${{ needs.version_and_tag.outputs.version }}
77+
78+
steps:
79+
- uses: actions/checkout@v4
80+
81+
- name: "Setup"
82+
run: |
83+
sudo apt-get install -y autoconf libtool-bin
84+
autoconf --version
85+
libtool --version
86+
87+
5988
- name: "Bootstrap"
6089
run: |
6190
./bootstrap.sh
6291
6392
- name: "Create source archive"
64-
run: dev/make_dist.sh ${{ steps.get-version.outputs.version }}
93+
run: dev/make_dist.sh ${FLINT_VERSION}
6594

6695
- name: "Upload source archive as artifact"
6796
uses: actions/upload-artifact@v3
6897
with:
6998
if-no-files-found: error
7099
name: flint
71-
path: flint-${{ steps.get-version.outputs.version }}.*
100+
path: flint-${{ env.FLINT_VERSION }}.*
72101
retention-days: 1
73102

74103
test-archive:
75-
needs: make-archive
104+
needs: [version_and_tag, make-archive]
76105
runs-on: ubuntu-latest
77106
env:
78-
FLINT_VERSION: ${{ needs.make-archive.outputs.get-version }}
107+
FLINT_VERSION: ${{ needs.version_and_tag.outputs.version }}
108+
TAG_NAME: ${{ needs.version_and_tag.outputs.tag_name }}
79109
steps:
80110
- name: "Download archive from previous job"
81111
uses: actions/download-artifact@v3
@@ -93,8 +123,8 @@ jobs:
93123
94124
- name: "Extract"
95125
run: |
96-
tar -xf flint-$FLINT_VERSION.tar.gz
97-
mv flint-$FLINT_VERSION flint # to simplify code
126+
tar -xf flint-${FLINT_VERSION}.tar.gz
127+
mv flint-${FLINT_VERSION} flint # to simplify code
98128
99129
- name: "Configure"
100130
run: |
@@ -121,23 +151,60 @@ jobs:
121151
$MAKE check
122152
123153
upload-archive:
124-
needs: [make-archive, test-archive]
154+
needs: [version_and_tag, make-archive, test-archive]
125155
runs-on: ubuntu-latest
126-
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
156+
env:
157+
FLINT_VERSION: ${{ needs.version_and_tag.outputs.version }}
158+
TAG_NAME: ${{ needs.version_and_tag.outputs.tag_name }}
159+
GH_REPO: ${{ github.repository }}
160+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
161+
permissions:
162+
contents: write
127163
steps:
128164
- name: "Download archive from previous job"
129165
uses: actions/download-artifact@v3
130166
with:
131167
name: flint
132168

169+
170+
# figure out SUBJECT and PRERELEASE
171+
- if: env.TAG_NAME == 'nightly'
172+
run: |
173+
(echo 'SUBJECT=FLINT nightly release';
174+
echo 'PRERELEASE=--prerelease') >> $GITHUB_ENV
175+
gh release delete nightly --yes || true
176+
git push origin :nightly || true
177+
178+
179+
- if: env.TAG_NAME != 'nightly'
180+
run: |
181+
(echo 'SUBJECT=FLINT release';
182+
echo 'PRERELEASE=') >> $GITHUB_ENV
183+
gh release delete stable --yes || true
184+
git push origin :stable || true
185+
186+
- name: Generate checksums
187+
run: |
188+
printf '## SHA256 Checksums\n```\n' > $RUNNER_TEMP/notes.md
189+
for ext in tar.gz tar.xz zip; do
190+
fn=flint-${FLINT_VERSION}.$ext
191+
# `sha256sum` outputs <sha> <path>,
192+
sha256sum $fn >> $RUNNER_TEMP/notes.md
193+
done
194+
printf '```\n' >> $RUNNER_TEMP/notes.md
195+
196+
# - name: Release
197+
# uses: softprops/action-gh-release@v1
198+
# with:
199+
# fail_on_unmatched_files: true
200+
# files: |
201+
# flint-${{ needs.make-archive.outputs.get-version }}.tar.gz
202+
# flint-${{ needs.make-archive.outputs.get-version }}.tar.xz
203+
# flint-${{ needs.make-archive.outputs.get-version }}.zip
204+
133205
- name: Release
134-
uses: softprops/action-gh-release@v1
135-
with:
136-
fail_on_unmatched_files: true
137-
files: |
138-
flint-${{ needs.make-archive.outputs.get-version }}.tar.gz
139-
flint-${{ needs.make-archive.outputs.get-version }}.tar.xz
140-
flint-${{ needs.make-archive.outputs.get-version }}.zip
206+
run: |
207+
gh release create $TAG_NAME $PRERELEASE --notes-file "$RUNNER_TEMP/notes.md" --title "$SUBJECT" --target $GITHUB_SHA flint-${FLINT_VERSION}.{tar.gz,tar.xz,zip}
141208
142209
# TODO: we could / should perhaps also test `make install` ?
143210
# TODO: also trigger a documentation build and upload the result?

0 commit comments

Comments
 (0)