-
Notifications
You must be signed in to change notification settings - Fork 227
46 lines (42 loc) · 1.77 KB
/
tag-create-github-release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Create Github Release & Tag version in Git
on:
workflow_dispatch:
workflow_call:
jobs:
tag-and-create-gh-release:
# pub-hk-ubuntu-22.04- due to IP allow list issues with public repos: https://salesforce.quip.com/bu6UA0KImOxJ
runs-on: pub-hk-ubuntu-22.04-small
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
with:
# fetch entire repo, not just this branch. Tags & commits are needed for release notes
fetch-depth: 0
- name: Install SSH Client 🔑
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_RELEASE_PRIVATE_KEY }}
- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: yarn
- name: set git user
run: |
git config user.name "GitHub Actions Bot"
git config user.email "[email protected]"
- name: Create & Push Git Tag
run: ./scripts/release/create-git-tag-and-push
shell: bash
- name: Release to Github
# the script below will fail if run from a separate shell file
run: |
PACKAGE_VERSION=$(node -e "console.log(require('./lerna.json').version)")
TAG_NAME="v${PACKAGE_VERSION}"
SORTED_TAGS=$(git tag --sort="-version:refname" --list --format="%(refname:strip=2)")
FILTERED_TAGS=$(echo "${SORTED_TAGS}" | grep 'v[0-9.]*' | grep -v '-' | grep -v $TAG_NAME)
LAST_PUBLISHED_TAG=$(echo "${FILTERED_TAGS}" | head -n1)
RELEASE_NOTES=$(git log --graph --format="%h %s" "${LAST_PUBLISHED_TAG}..${TAG_NAME}~1")
gh release create "${TAG_NAME}" --title="${TAG_NAME}" --notes="${RELEASE_NOTES}"
shell: bash