-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# Launched manually | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
release_branch_name: | ||
description: 'Release branch name, must start with v' | ||
required: true | ||
default: 'v0.1.0-rc.1' | ||
|
||
|
||
jobs: | ||
build: | ||
name: Prep release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout the code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check release version and set next version | ||
run: | | ||
if ! echo "${{ github.event.inputs.release_branch_name }}" | grep ^v ; then | ||
echo "Incorrect release branch name ${{ github.event.inputs.release_branch_name }}, must start with 'v'" ; exit 1 | ||
fi | ||
if echo "${{ github.ref_name }}" | grep ^dev ; then | ||
# set next dev version GH env, otherwise set it empty | ||
echo "NEXT_DEV_VERSION=$(echo ${{ github.ref_name }} | awk -F. -v OFS=. '{$NF += 1 ; print}')" >> $GITHUB_ENV | ||
fi | ||
- name: Code format, dependencies, checks | ||
run: | | ||
find . -type d -print0 | xargs -0 -n1 terraform fmt | ||
- name: Check code builds and pass acceptance test | ||
run: | | ||
ci/scripts/test-module.sh ci/module-test | ||
for dir in examples/*; do (ci/scripts/test-module.sh "$dir"); done | ||
- name: Ensure version reflects release candidate version | ||
run: | | ||
VERSION=$(echo "${{ github.event.inputs.release_branch_name }}" | cut -d'v' -f2) | ||
echo $VERSION > VERSION | ||
- name: Check changed files | ||
uses: tj-actions/verify-changed-files@v17 | ||
id: check-changed-files | ||
|
||
- name: Run step only when any of the files change | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
echo "Changed files: ${{ steps.check-changed-files.outputs.changed_files }}" | ||
- name: Commit back updates when any of the files change | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
committer_name: GitHub Actions | ||
committer_email: [email protected] | ||
message: 'Updating release candidate [skip ci]' | ||
new_branch: GeneratedSourceUpdates-${{ github.ref_name }} | ||
|
||
- name: Create pull request if needed, then break here because manual approval of the changes is required | ||
if: steps.check-changed-files.outputs.files_changed == 'true' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
CURRENT_BRANCH=${GITHUB_REF_NAME} | ||
gh pr create -B ${CURRENT_BRANCH} -H "GeneratedSourceUpdates-${CURRENT_BRANCH}" --title "Merge generated source updates into release candidate ${CURRENT_BRANCH}" --body 'Created by Github action' | ||
echo Review and approve PR before release can continue | ||
exit 1 // force actions stop here | ||
- name: Create the release branch | ||
uses: peterjgrainger/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
branch: "${{ github.event.inputs.release_branch_name }}" | ||
|
||
# - name: Tag the release branch | ||
# if: env.NEXT_DEV_VERSION != '' | ||
# uses: peterjgrainger/[email protected] | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# with: | ||
# branch: ${{ env.NEXT_DEV_VERSION }} | ||
|