Skip to content

Commit edf6276

Browse files
authored
Github action to create release (#197)
1 parent 3b3b7eb commit edf6276

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

.github/workflows/create-release.yml

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: "Create a release"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag:
7+
description: "Tag for new version (1.23.4)"
8+
required: true
9+
10+
jobs:
11+
create-tag:
12+
name: "Create a release"
13+
runs-on: ubuntu-latest
14+
15+
defaults:
16+
run:
17+
shell: bash
18+
19+
steps:
20+
- name: Generate token
21+
id: generate_token
22+
uses: actions/create-github-app-token@v1
23+
with:
24+
app-id: ${{ secrets.TEMPORAL_CICD_APP_ID }}
25+
private-key: ${{ secrets.TEMPORAL_CICD_PRIVATE_KEY }}
26+
27+
- name: Checkout
28+
uses: actions/checkout@v4
29+
with:
30+
persist-credentials: true
31+
token: ${{ steps.generate_token.outputs.token }}
32+
fetch-depth: 0
33+
fetch-tags: true
34+
35+
- name: Set up Github credentials
36+
run: |
37+
git config --local user.name 'Temporal Data'
38+
git config --local user.email '[email protected]'
39+
40+
- name: Update images version
41+
env:
42+
TAG: ${{ github.event.inputs.tag }}
43+
run: |
44+
find ./k8s -iname "*.yaml" -exec sed -i -E -e "s#temporalio/(auto-setup|admin-tools):[^ ]+#temporalio/\1:$TAG#g" {} \;
45+
sed -i -e "s/^TEMPORAL_VERSION=.*$/TEMPORAL_VERSION=$TAG/g" .env
46+
if [ -n "$(git diff --stat)" ]; then
47+
git add .
48+
git commit -m "Bump Server version to $TAG"
49+
git push origin main
50+
fi
51+
52+
- name: Create and push tag
53+
env:
54+
TAG: 'v${{ github.event.inputs.tag }}'
55+
run: |
56+
if [ -z "$(git tag -l $TAG)" ]; then
57+
git tag "$TAG"
58+
git push origin "$TAG"
59+
elif [ "$(git rev-list -n 1 $TAG)" != "$(git rev-parse HEAD)" ]; then
60+
echo "::error::Tag already exists and it doesn't reference current HEAD of main branch"
61+
exit 1
62+
fi
63+
64+
- name: Create draft release notes
65+
id: release_notes
66+
env:
67+
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
68+
TAG: 'v${{ github.event.inputs.tag}}'
69+
run: |
70+
TEMPFILE=$(mktemp)
71+
cat > $TEMPFILE <<- EOF
72+
# Release Highlights
73+
Please check [main repo](https://github.com/temporalio/temporal/releases/tag/${TAG}) release notes.
74+
EOF
75+
76+
gh repo set-default ${{ github.repository }}
77+
RELEASE_URL=$(gh release create "$TAG" --verify-tag --draft --title "$TAG" -F $TEMPFILE)
78+
echo "RELEASE_URL=$RELEASE_URL" >> "$GITHUB_OUTPUT"
79+
80+
- name: Create summary
81+
if: ${{ github.event.inputs.release_notes }}
82+
run: |
83+
TEMPFILE=$(mktemp)
84+
cat > $TEMPFILE <<- EOF
85+
# Job summary
86+
Draft release: ${{ steps.release_notes.outputs.RELEASE_URL }}
87+
EOF
88+
89+
cat $TEMPFILE >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)