Skip to content

Commit 1242284

Browse files
Add an action to perform automatic releases
This action automatically does the following every thursday at 9:00 AM: * Create a commit that increments the last number of CBMC_VERSION in src/config.inc * Perform a release tagged with the new CBMC_VERSION number This only saves us a tiny bit of work right now, but we’ll add actions to automatically create and upload binary artifacts for these releases soon.
1 parent 7d30335 commit 1242284

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
on:
2+
schedule:
3+
# ┌───────────── minute (0 - 59)
4+
# │ ┌───────────── hour (0 - 23)
5+
# │ │ ┌───────────── day of the month (1 - 31)
6+
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
7+
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
8+
# │ │ │ │ │
9+
# │ │ │ │ │
10+
# │ │ │ │ │
11+
- cron: '0 9 * * THU'
12+
# ^ this means 9:00 AM every thursday
13+
# I can’t figure out the right syntax
14+
# for ‘every other thursday’
15+
16+
jobs:
17+
bump-cbmc-version:
18+
runs-on: ubuntu-20.04
19+
outputs:
20+
CBMC_VERSION: ${{steps.cbmc_version_number.outputs.CBMC_VERSION}}
21+
steps:
22+
- uses: actions/checkout@v2
23+
with:
24+
submodules: recursive
25+
- name: Get new CBMC version number
26+
id: cbmc_version_number
27+
run: |
28+
NEW_CBMC_VERSION=$(grep '^CBMC_VERSION =' src/config.inc | cut -d = -f 2 | scripts/increment_version.sh)
29+
echo ::set-env name=CBMC_VERSION::$NEW_CBMC_VERSION
30+
echo ::set-output name=CBMC_VERSION::$NEW_CBMC_VERSION
31+
- name: Update CBMC version
32+
run: |
33+
sed -i "s/CBMC_VERSION = .*/CBMC_VERSION = $CBMC_VERSION/" src/config.inc
34+
- name: Set git identity to github bot
35+
run: |
36+
git config --local user.name github-actions
37+
git config --local user.email "[email protected]"
38+
- name: Commit changes
39+
run: |
40+
git commit -a -m "Bump version to $CBMC_VERSION"
41+
- name: Push changes
42+
run: |
43+
git push
44+
perform-release:
45+
needs: bump-cbmc-version
46+
runs-on: ubuntu-20.04
47+
steps:
48+
- uses: actions/checkout@v2
49+
- name: Create release
50+
uses: actions/create-release@v1
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
with:
54+
tag_name: cbmc-${{needs.bump-cbmc-version.outputs.CBMC_VERSION}}
55+
release_name: cbmc-${{needs.bump-cbmc-version.outputs.CBMC_VERSION}}
56+
draft: false
57+
prerelease: true

scripts/increment_version.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
read -r version_line
2+
major=$(echo $version_line | cut -d . -f 1)
3+
minor=$(echo $version_line | cut -d . -f 2)
4+
patch=$(echo $version_line | cut -d . -f 3)
5+
echo "$major.$minor.$(expr $patch + 1)"

0 commit comments

Comments
 (0)