Skip to content

Commit cbadaa5

Browse files
Merge pull request #5456 from hannes-steffenhagen-diffblue/CI/automatic-release
Add an action to perform automatic releases
2 parents e06f678 + fbdd9c0 commit cbadaa5

File tree

2 files changed

+73
-0
lines changed

2 files changed

+73
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
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+
bump_git_sha: ${{ steps.commit_bump.outputs.bump_git_sha }}
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
submodules: recursive
26+
- name: Get new CBMC version number
27+
id: cbmc_version_number
28+
run: |
29+
NEW_CBMC_VERSION=$(grep '^CBMC_VERSION =' src/config.inc | cut -d = -f 2 | scripts/increment_version.sh)
30+
echo ::set-env name=CBMC_VERSION::$NEW_CBMC_VERSION
31+
echo ::set-output name=CBMC_VERSION::$NEW_CBMC_VERSION
32+
- name: Update CBMC version
33+
run: |
34+
sed -i "s/CBMC_VERSION = .*/CBMC_VERSION = $CBMC_VERSION/" src/config.inc
35+
- name: Set git identity to github bot
36+
run: |
37+
git config --local user.name db-ci-cprover
38+
git config --local user.email "[email protected]"
39+
- name: Commit changes
40+
id: commit_bump
41+
run: |
42+
git commit -a -m "Bump version to $CBMC_VERSION"
43+
echo "::set-output name=bump_git_sha::$(git rev-parse HEAD)"
44+
- name: Push changes
45+
run: |
46+
git push
47+
perform-release:
48+
needs: bump_cbmc_version
49+
runs-on: ubuntu-20.04
50+
steps:
51+
- uses: actions/checkout@v2
52+
with:
53+
# We just added a commit to master, so the default GITHUB_REF doesn’t work anymore
54+
ref: master
55+
- name: DEBUG show bump version
56+
run: echo ${{ needs.bump_cbmc_version.outputs.CBMC_VERSION }}
57+
- name: Create release
58+
uses: actions/create-release@v1
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.DB_CI_CPROVER_ACCESS_TOKEN }}
61+
with:
62+
tag_name: cbmc-${{ needs.bump_cbmc_version.outputs.CBMC_VERSION }}
63+
release_name: cbmc-${{ needs.bump_cbmc_version.outputs.CBMC_VERSION }}
64+
draft: false
65+
prerelease: false
66+
commitish: ${{ needs.bump_cbmc_version.outputs.bump_git_sha }}

scripts/increment_version.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# By default, just create a new minor version. If we ever need to change
2+
# major/patch version just do it manually.
3+
read -r version_line
4+
major=$(echo $version_line | cut -d . -f 1)
5+
minor=$(echo $version_line | cut -d . -f 2)
6+
patch=$(echo $version_line | cut -d . -f 3)
7+
echo "$major.$(expr $minor + 1).0"

0 commit comments

Comments
 (0)