Release #218
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 | |
runs-on: [self-hosted, release] | |
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@1e31de5234b9f8995739874a8ce0492dc87873e2 # v4.0.0 | |
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: Push release branch | |
run: | | |
git push origin --delete $RELEASE_BRANCH_NAME || true | |
git push -u origin $RELEASE_BRANCH_NAME | |
env: | |
RELEASE_BRANCH_NAME: ${{ steps.variables.outputs.releaseBranchName }} | |
- name: Setup Environment | |
id: setup-env | |
uses: ./.github/actions/setup-env | |
- name: Run Build | |
run: ./cicd/run-build | |
- name: Run Unit Tests | |
run: ./cicd/run-unit-tests | |
# TODO(https://github.com/GoogleCloudPlatform/DataflowTemplates/issues/1807) - Remove once Staging Spanner tests | |
# are fixed | |
- name: Run Integration Smoke Tests | |
run: | | |
./cicd/run-it-smoke-tests \ | |
--it-region="us-central1" \ | |
--it-project="cloud-teleport-testing" \ | |
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \ | |
--it-private-connectivity="datastream-private-connect-us-central1" \ | |
--it-spanner-host="https://batch-spanner.googleapis.com" \ | |
--it-release=true \ | |
--it-retry-failures=2 | |
# TODO(https://github.com/GoogleCloudPlatform/DataflowTemplates/issues/1807) - Remove once Staging Spanner tests | |
# are fixed | |
- name: Run Integration Tests | |
run: | | |
./cicd/run-it-tests \ | |
--it-region="us-central1" \ | |
--it-project="cloud-teleport-testing" \ | |
--it-artifact-bucket="cloud-teleport-testing-it-gitactions" \ | |
--it-private-connectivity="datastream-private-connect-us-central1" \ | |
--it-spanner-host="https://batch-spanner.googleapis.com" \ | |
--it-release=true \ | |
--it-retry-failures=2 | |
- name: Upload Site Report | |
uses: ./.github/actions/publish-site-report | |
with: | |
output-zip-file: test-report | |
if: always() | |
- name: Push tags | |
run: | | |
git push -u origin --tags | |
- name: Release | |
run: | | |
gh release delete $TAG_NAME -y || true | |
gh release create $TAG_NAME --title "Dataflow Templates $TAG_NAME" --notes "" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAG_NAME: ${{ steps.variables.outputs.tagName }} |