Skip to content

Commit

Permalink
ci: Make flank release more automatically (#1352)
Browse files Browse the repository at this point in the history
Fixes #1346 

## Test Plan
> How do we know the code works?

1. Create release notes job (this which generates documentation and changelog) will run each 1st day of the month
2. After merge Pr with changelog
3. Flank-release bot will push the tag with next version to repository
4. Then release job will run as usual

## Checklist

- [x] Documented
- [x] At schedule to run release job at 1st day of the month
- [x] Create job which will push release tag after merge PR
  • Loading branch information
piotradamczyk5 authored Nov 27, 2020
1 parent 35beb6d commit b4679f6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/create_new_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Create new release

on:
pull_request:
types: [ closed ]

jobs:
create_release:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release') && contains(github.event.pull_request.user.login, 'flank-release[bot]') && contains(github.event.pull_request.title, 'release notes for')
steps:
- uses: actions/checkout@v2
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.FLANK_RELEASE_APP_ID }}
private_key: ${{ secrets.FLANK_RELEASE_PRIVATE_KEY }}

- name: Gradle Build flankScripts and add it to PATH
run: |
./flank-scripts/bash/buildFlankScripts.sh
echo "./flank-scripts/bash" >> $GITHUB_PATH
- name: Set next release tag variable
run: |
TAG=$(flankScripts ci nextReleaseTag --token=${{ secrets.GITHUB_TOKEN }})
echo "NEXT_RELEASE_TAG=$(echo $TAG)" >> $GITHUB_ENV
- name: Push tag
id: tag_version
uses: mathieudutour/github-tag-action@v5
with:
github_token: ${{ steps.generate-token.outputs.token }}
custom_tag: ${{ env.NEXT_RELEASE_TAG }}
tag_prefix: ''
2 changes: 2 additions & 0 deletions .github/workflows/release_notes_generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: "Generate release notes for next commit"

on:
workflow_dispatch:
schedule:
- cron: 0 7 1 * *

jobs:
generateReleaseNotes:
Expand Down
11 changes: 9 additions & 2 deletions docs/release_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,19 @@ Each push:
- to `master` branch run Snapshot release
- of tag `v*` run regular release

## Manual Steps
## Triggering release

### Manually
1. Navigate to [Github Actions](https://github.com/Flank/flank/actions)
2. Run job [`Generate release notes for next commit`](https://github.com/Flank/flank/actions?query=workflow%3A%22Generate+release+notes+for+next+commit%22) by using `Run Workflow` button
3. After merging, push a tag for the release
3. After merging PR, the next tag will be pushed to repository
4. Wait for CI job to finish

### Automatically
1. Release job will run each 1st day of month
2. After merging PR, the next tag will be pushed to repository
2. Wait for CI job to finish

## CI Steps
1. Gradle Build flankScripts and add it to PATH
2. Set environment variables
Expand Down

0 comments on commit b4679f6

Please sign in to comment.