-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (56 loc) · 1.96 KB
/
versioning-latest.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
name: auto versioning for master branch
on:
push:
tags-ignore:
- '**'
branches:
- master
jobs:
version-up-main:
runs-on: ubuntu-latest
env:
# https://github.community/t/github-action-trigger-on-release-not-working-if-releases-was-created-by-automation/16559
GITHUB_USER: ${{ secrets.EXT_GITHUB_USER }}
GITHUB_TOKEN: ${{ secrets.EXT_GITHUB_PAT }}
RELEASE_IT_VERSION: 14.14.0
BUMPER_VERSION: 3.0.1
steps:
- name: Check out codes
uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.EXT_GITHUB_PAT }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install poetry
run: pip install poetry
- name: Set releaser settings
run: |
git config --global user.name ${{ secrets.EXT_GITHUB_USER }}
git config --global user.email ${{ secrets.EXT_GITHUB_EMAIL }}
# バージョン更新コミットは対象外
- name: Patch release
if: "!contains(toJSON(github.event.commits.*.message), '[automate_versioning] Release')"
run: |
echo 'UPDATE_ARGS=patch' >> $GITHUB_ENV
- name: Minor release
if: contains(toJSON(github.event.commits.*.message), '[[MINOR]]')
run: |
echo 'UPDATE_ARGS=minor' >> $GITHUB_ENV
- name: Major release
if: contains(toJSON(github.event.commits.*.message), '[[MAJOR]]')
run: |
echo 'UPDATE_ARGS=major' >> $GITHUB_ENV
- name: Resolve version num
run: |
echo RELEASE_VERSION=$(poetry version -s ${{ env.UPDATE_ARGS }}) >> $GITHUB_ENV
- name: Release
if: "env.UPDATE_ARGS != ''"
run: |
git add pyproject.toml
git commit -m "[automate_versioning] Release ${{ env.RELEASE_VERSION }}"
git tag ${{ env.RELEASE_VERSION }}
git push origin ${{ env.RELEASE_VERSION }}
git push