-
Notifications
You must be signed in to change notification settings - Fork 66
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
1 parent
7db666c
commit 2cab9a7
Showing
1 changed file
with
72 additions
and
47 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 |
---|---|---|
|
@@ -20,40 +20,27 @@ on: | |
skip_sdk_check: | ||
description: "Skip sdk-go compatibility check" | ||
type: boolean | ||
default: false | ||
|
||
jobs: | ||
create-tag: | ||
name: "Create a tag" | ||
prepare-inputs: | ||
name: "Prepare inputs" | ||
runs-on: ubuntu-latest | ||
|
||
outputs: | ||
tag: ${{ steps.new_version.output.tag }} | ||
api_commit_sha: ${{ steps.new_version.output.commit_sha }} | ||
api_go_commit_sha: ${{ steps.pin_api_go.output.api_go_commit_sha }} | ||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }} | ||
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }} | ||
owner: ${{ github.repository_owner }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.branch }} | ||
token: ${{ steps.generate_token.outputs.token }} | ||
persist-credentials: true | ||
ref: ${{ github.event.inputs.branch }} | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- name: Set up Github credentials | ||
run: | | ||
git config --local user.name 'Temporal Data' | ||
git config --local user.email '[email protected]' | ||
- name: Prepare new version string | ||
id: new_version | ||
env: | ||
TAG: ${{ inputs.tag }} | ||
TAG: ${{ github.event.inputs.tag }} | ||
run: | | ||
if [[ "${TAG}" =~ ^v.* ]]; then | ||
echo "tag=${TAG}" >> "$GITHUB_OUTPUT" | ||
|
@@ -62,12 +49,12 @@ jobs: | |
fi | ||
echo "commit_sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | ||
- name: Validate input | ||
- name: Validate inputs | ||
env: | ||
BRANCH: ${{ inputs.branch }} | ||
BRANCH: ${{ github.event.inputs.branch }} | ||
TAG: ${{ steps.new_version.outputs.tag }} | ||
CREATE_RELEASE: ${{ inputs.create_release }} | ||
BASE_TAG: ${{ inputs.base_tag }} | ||
CREATE_RELEASE: ${{ github.event.inputs.create_release }} | ||
BASE_TAG: ${{ github.event.inputs.base_tag }} | ||
run: | | ||
if [[ -n "$(git tag -l "$TAG")" && "$(git rev-parse "$TAG")" != "$(git rev-parse HEAD)" ]]; then | ||
echo "::error::Tag already exists and it doesn't reference current HEAD of branch $BRANCH" | ||
|
@@ -82,46 +69,84 @@ jobs: | |
fi | ||
- name: Pin api-go commit sha | ||
id: pin-api-go | ||
id: pin_api_go | ||
env: | ||
BRANCH: ${{ inputs.branch }} | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: ${{ github.event.inputs.branch }} | ||
run: | | ||
API_GO_COMMIT_SHA=$(gh api /repos/temporalio/api-go/branches/$BRANCH --jq '.commit.sha') | ||
echo "API_GO_COMMIT_SHA=$API_GO_COMMIT_SHA" >> "$GITHUB_OUTPUT" | ||
echo "api_go_commit_sha=$API_GO_COMMIT_SHA" >> "$GITHUB_OUTPUT" | ||
- name: Check compatibility with sdk-go | ||
if: ${{ inputs.skip_sdk_check == 'false' }} | ||
uses: temporalio/sdk-go/.github/workflows/check-api-go.yml@master | ||
check-compatibility-sdk-go: | ||
needs: prepare-inputs | ||
if: ${{ github.event.inputs.skip_sdk_check == false || github.event.inputs.skip_sdk_check == 'false' }} | ||
uses: temporalio/api-go/.github/workflows/check-sdk-compat.yml@master | ||
with: | ||
sdk_commit: latest | ||
api_commit: ${{ needs.prepare-inputs.outputs.api_go_commit_sha }} | ||
|
||
create-tag: | ||
name: "Create a tag" | ||
needs: [prepare-inputs, check-compatibility-sdk-go] | ||
if: | | ||
!cancelled() && | ||
needs.prepare-inputs.result == 'success' && | ||
contains(fromJSON('["success", "skipped"]'), needs.check-compatibility-sdk-go.result) | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Generate token | ||
id: generate_token | ||
uses: actions/create-github-app-token@v1 | ||
with: | ||
sdk_commit: latest | ||
api_commit: ${{ steps.pin-api-go.outputs.API_GO_COMMIT_SHA }} | ||
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }} | ||
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }} | ||
owner: ${{ github.repository_owner }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ needs.prepare-inputs.outputs.commit_sha }} | ||
token: ${{ steps.generate_token.outputs.token }} | ||
persist-credentials: true | ||
fetch-depth: 0 | ||
fetch-tags: true | ||
|
||
- name: Set up Github credentials | ||
run: | | ||
git config --local user.name 'Temporal Data' | ||
git config --local user.email '[email protected]' | ||
- name: Create and push tag | ||
env: | ||
BRANCH: ${{ inputs.branch }} | ||
TAG: ${{ steps.new_version.outputs.tag }} | ||
TAG: ${{ needs.prepare-inputs.outputs.tag }} | ||
run: | | ||
if [[ -z "$(git tag -l "$TAG")" ]]; then | ||
git tag "$TAG" | ||
git push origin "$TAG" | ||
fi | ||
- name: Create release | ||
if: ${{ inputs.create_release == 'true' }} | ||
if: ${{ github.event.inputs.create_release == true || github.event.inputs.create_release == 'true' }} | ||
env: | ||
GH_TOKEN: ${{ steps.generate_token.outputs.token }} | ||
TAG: ${{ steps.new_version.outputs.tag }} | ||
BASE_TAG: ${{ inputs.base_tag }} | ||
TAG: ${{ needs.prepare-inputs.outputs.tag }} | ||
BASE_TAG: ${{ github.event.inputs.base_tag }} | ||
run: | | ||
gh repo set-default ${{ github.repository }} | ||
gh release create "$TAG" --verify-tag --latest --generate-notes --notes-start-tag "$BASE_TAG" | ||
- name: Release api-go | ||
if: ${{ inputs.create_release == 'true' }} | ||
uses: temporalio/api-go/.workflows/create-tag.yml@master | ||
with: | ||
token: ${{ steps.generate_token.outputs.token }} | ||
ref: ${{ steps.pin-api-go.outputs.API_GO_COMMIT_SHA }} | ||
tag: ${{ steps.new_version.outputs.tag }} | ||
create_release: true | ||
base_tag: ${{ inputs.base_tag }} | ||
release-api-go: | ||
needs: create-tag | ||
if: | | ||
!cancelled() && | ||
(needs.create-tag.result == 'success') && | ||
(github.event.inputs.create_release == true || github.event.inputs.create_release == 'true') | ||
uses: temporalio/api-go/.github/workflows/create-tag.yml@master | ||
with: | ||
ref: ${{ needs.prepare-inputs.outputs.api_go_commit_sha }} | ||
tag: ${{ needs.prepare-inputs.outputs.tag }} | ||
create_release: true | ||
base_tag: ${{ github.event.inputs.base_tag }} | ||
skip_sdk_check: true | ||
secrets: inherit |