-
Notifications
You must be signed in to change notification settings - Fork 3
68 lines (64 loc) · 2.48 KB
/
release-candidate.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: "Release: Create release candidate"
on:
workflow_dispatch:
branches:
- "release/*" # only documentation, it is not tested on workflow_dispatch
inputs:
confirmation:
description: 'Create release tag and publish package'
required: true
default: false
type: boolean
jobs:
create-release-candidate:
runs-on: ubuntu-latest
outputs:
ref: v${{ steps.package-version.outputs.version }}
sha: ${{ steps.tag-revision.outputs.sha }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6
- name: Allow only for release branch
run: |
if [[ ${{ steps.branch-name.outputs.current_branch }} != release* ]] ;
then
echo "Only allowed to get triggered on release branches!"
echo "You started it on '${{ steps.branch-name.outputs.current_branch }}'."
exit 1
fi
- uses: actions/checkout@v3
- name: Initialize mandatory git config
# @see https://github.community/t/how-do-i-get-gh-username-based-on-actions-events/17882
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Get version
id: package-version
run: echo "version=$(node -p -e "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Create version tag
id: tag-revision
run: |
git tag -a v${{ steps.package-version.outputs.version }} -m "tag release candidate v${{ steps.package-version.outputs.version }}"
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Bump release candidate version in package.json
run: |
yarn version --no-git-tag-version --preid "rc" --prerelease
git commit package.json --message "Bump release version to next release candidate $(node -p -e "require('./package.json').version")\n\n\nrequest-checks: true"
- name: Push tag and changes
run: |
git push
git push origin v${{ steps.package-version.outputs.version }}
publish-package:
needs: create-release-candidate
uses: ./.github/workflows/release-publish.yml
with:
ref: ${{ needs.create-release-candidate.outputs.ref }}
sha: ${{ needs.create-release-candidate.outputs.sha }}
sectionChangelog: Unreleased
secrets:
chromaticToken: None
npmjsToken: ${{ secrets.NPMJS_REGISTRY_TOKEN }}