-
Notifications
You must be signed in to change notification settings - Fork 274
Add an action to perform automatic releases #5456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
on: | ||
schedule: | ||
# ┌───────────── minute (0 - 59) | ||
# │ ┌───────────── hour (0 - 23) | ||
# │ │ ┌───────────── day of the month (1 - 31) | ||
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | ||
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
# │ │ │ │ │ | ||
- cron: '0 9 * * THU' | ||
# ^ this means 9:00 AM every thursday | ||
# I can’t figure out the right syntax | ||
# for ‘every other thursday’ | ||
|
||
jobs: | ||
bump_cbmc_version: | ||
runs-on: ubuntu-20.04 | ||
outputs: | ||
cbmc_version: ${{ steps.cbmc_version_number.outputs.CBMC_VERSION }} | ||
bump_git_sha: ${{ steps.commit_bump.outputs.bump_git_sha }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
submodules: recursive | ||
- name: Get new CBMC version number | ||
id: cbmc_version_number | ||
run: | | ||
NEW_CBMC_VERSION=$(grep '^CBMC_VERSION =' src/config.inc | cut -d = -f 2 | scripts/increment_version.sh) | ||
echo ::set-env name=CBMC_VERSION::$NEW_CBMC_VERSION | ||
echo ::set-output name=CBMC_VERSION::$NEW_CBMC_VERSION | ||
- name: Update CBMC version | ||
run: | | ||
sed -i "s/CBMC_VERSION = .*/CBMC_VERSION = $CBMC_VERSION/" src/config.inc | ||
- name: Set git identity to github bot | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this name still valid after the change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. err, no I need to update the name of this step. edit github bot is probably the right name for this |
||
run: | | ||
git config --local user.name db-ci-cprover | ||
git config --local user.email "[email protected]" | ||
- name: Commit changes | ||
id: commit_bump | ||
run: | | ||
git commit -a -m "Bump version to $CBMC_VERSION" | ||
echo "::set-output name=bump_git_sha::$(git rev-parse HEAD)" | ||
- name: Push changes | ||
run: | | ||
git push | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❔ Which branch is this pushing to? Might be nice to have a comment with the answer. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We didn’t specify a branch in |
||
perform-release: | ||
needs: bump_cbmc_version | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
# We just added a commit to master, so the default GITHUB_REF doesn’t work anymore | ||
ref: master | ||
- name: DEBUG show bump version | ||
run: echo ${{ needs.bump_cbmc_version.outputs.CBMC_VERSION }} | ||
- name: Create release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.DB_CI_CPROVER_ACCESS_TOKEN }} | ||
with: | ||
tag_name: cbmc-${{ needs.bump_cbmc_version.outputs.CBMC_VERSION }} | ||
release_name: cbmc-${{ needs.bump_cbmc_version.outputs.CBMC_VERSION }} | ||
draft: false | ||
prerelease: false | ||
commitish: ${{ needs.bump_cbmc_version.outputs.bump_git_sha }} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# By default, just create a new minor version. If we ever need to change | ||
# major/patch version just do it manually. | ||
read -r version_line | ||
major=$(echo $version_line | cut -d . -f 1) | ||
minor=$(echo $version_line | cut -d . -f 2) | ||
patch=$(echo $version_line | cut -d . -f 3) | ||
echo "$major.$(expr $minor + 1).0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually having looked into this a bit more I don't think there is a right syntax for "every other thursday". The cron syntax we have available here is very limited (see: https://crontab.guru/#0_9_*_*_THU)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I don't think Cron syntax supports that - best you can probably do is to run this job every thursday, and then in the job check if it's a release Thursday or not (and short circuit if its not). Might want to think about timezones as well?