Release #42
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
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
candidateName: | |
description: 'Name of the candidate' | |
type: string | |
required: true | |
branchCommit: | |
description: 'Commit to check out. If it is the most recent commit then leave blank.' | |
type: string | |
required: false | |
default: '' | |
cherrypickCommits: | |
description: 'Comma separated commits to cherry pick' | |
type: string | |
required: false | |
permissions: | |
contents: write | |
jobs: | |
release: | |
name: Create Release | |
# TODO: Change this to [self-hosted, it] | |
runs-on: [self-hosted, it] | |
steps: | |
- name: Get releaser identity | |
run: | | |
git config --global user.name '${{github.actor}}' | |
git config --global user.email '${{github.actor}}@users.noreply.github.com' | |
- name: Declare release branch name and tag name | |
id: variables | |
run: | | |
echo "releaseBranchName=release_${CANDIDATE_NAME,,}" >> $GITHUB_OUTPUT | |
echo "tagName=${CANDIDATE_NAME^^}" >> $GITHUB_OUTPUT | |
env: | |
CANDIDATE_NAME: ${{ inputs.candidateName }} | |
- name: Checkout code | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.RELEASE_TOKEN }} | |
- name: Create release branch | |
run: git checkout -b $RELEASE_BRANCH_NAME $BRANCH_COMMIT | |
env: | |
RELEASE_BRANCH_NAME: ${{ steps.variables.outputs.releaseBranchName }} | |
BRANCH_COMMIT: ${{ inputs.branchCommit }} | |
- name: Cherry pick commits | |
run: | | |
commits=$(echo $CHERRYPICK_COMMITS | tr "," "\n") | |
for commit in $commits | |
do | |
echo "Cherry picking $commit." | |
git cherry-pick $commit | |
done | |
env: | |
CHERRYPICK_COMMITS: ${{ inputs.cherrypickCommits }} | |
- name: Add tag to most recent commit | |
run: | | |
DATE=$(date -d"next-monday - 1week" +'%Y-%m-%d') | |
T_COMMIT=$(git log -n 1 $RELEASE_BRANCH_NAME --pretty=format:'%H') | |
git tag -a $TAG_NAME -m "Release week of $DATE" $T_COMMIT | |
env: | |
RELEASE_BRANCH_NAME: ${{ steps.variables.outputs.releaseBranchName }} | |
TAG_NAME: ${{ steps.variables.outputs.tagName }} | |
- name: Setup Environment | |
id: setup-env | |
uses: ./.github/actions/setup-env | |
- name: Run Build | |
run: ./cicd/run-build --changed-files="pom.xml" | |
- name: Run Unit Tests | |
run: ./cicd/run-unit-tests --changed-files="pom.xml" | |
- name: Run Integration Smoke Tests | |
run: | | |
./cicd/run-it-smoke-tests \ | |
--changed-files="pom.xml" \ | |
--it-region="us-central1" \ | |
--it-project="cloud-teleport-testing" \ | |
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" | |
- name: Run Integration Tests | |
run: | | |
./cicd/run-it-tests \ | |
--changed-files="pom.xml" \ | |
--it-region="us-central1" \ | |
--it-project="cloud-teleport-testing" \ | |
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" | |
- name: Create artifacts and push | |
# TODO: Change this to dataflow-templates-testing | |
run: | | |
mvn verify -PtemplatesRelease \ | |
-DprojectId="pranavbhandari-test" \ | |
-DbucketName="pranavbhandari-test-staging" \ | |
-DlibrariesBucketName="pranavbhandari-test-libraries" \ | |
-DstagePrefix="${CANDIDATE_NAME}" \ | |
-Dmaven.test.skip -e | |
env: | |
CANDIDATE_NAME: ${{ inputs.candidateName }} | |
# - name: Push changes | |
# run: | | |
# git push -u origin --all | |
# git push -u origin --tags | |
# - name: Release | |
# run: | | |
# gh release create $TAG_NAME --title "Dataflow Templates $TAG_NAME" --notes "" | |
# env: | |
# GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# TAG_NAME: ${{ steps.variables.outputs.tagName }} |