-
Notifications
You must be signed in to change notification settings - Fork 4
97 lines (81 loc) · 2.76 KB
/
bump2release.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
name: Bump version to release
on:
workflow_dispatch:
inputs:
MAJOR_OR_MINOR:
type: choice
description: major/minor release
options:
- minor
- major
default: minor
required: true
VERSION_NAME:
type: string
description: major version name
default: ''
jobs:
bump_version:
name: Bump version and tag for release
runs-on: ubuntu-latest
env:
GIT_USERNAME: ${{ github.actor }}
GIT_USEREMAIL: "${{ github.actor }}@endlessos.org"
outputs:
tagname: ${{ steps.have_new_tagname.outputs.tagname }}
steps:
- uses: actions/checkout@v3
with:
# Need to fetch everything so that 'git describe' can see the tags
fetch-depth: 0
- name: Set up Git environment
run: |
git config --global user.name $GIT_USERNAME
git config --global user.email $GIT_USEREMAIL
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Set up Node
uses: actions/setup-node@v3
with:
# Should be same version as in scripts/bootstrap.sh
node-version: '16.14.0'
- name: Install latest pipenv
run: |
python -m pip install --upgrade pipenv wheel
- name: Install dependencies in pipenv
run: |
bash ./scripts/bootstrap.sh --ci
- name: Bump minor version
if: ${{ inputs.MAJOR_OR_MINOR != 'major' }}
run: |
pipenv run yarn bump-version minor
- name: Bump major version
if: ${{ inputs.MAJOR_OR_MINOR == 'major' }}
run: |
if [ ${{ inputs.VERSION_NAME }} = '' ]
then
echo "Inputs' VERSION_NAME must be set with a non-empty string"
exit 22
fi
pipenv run yarn bump-version major ${{ inputs.VERSION_NAME }}
- name: Push bump commit & tag to stable branch
id: have_new_tagname
run: |
git show
tagname=$(git describe --always --tags --match 'v*')
git push origin ${{ github.ref_name }} $tagname
echo "tagname=$tagname" >> $GITHUB_OUTPUT
release:
# Using the GITHUB_TOKEN in a workflow will not create a new workflow run to
# prevent from accidentally creating recursive workflow runs. So, call the
# following workflow here and inherit the secrets by design.
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow
name: Release
needs: bump_version
if: startsWith(needs.bump_version.outputs.tagname, 'v')
uses: ./.github/workflows/release.yml
with:
tagname: ${{ needs.bump_version.outputs.tagname }}
secrets: inherit