This repository has been archived by the owner on Nov 30, 2022. It is now read-only.
generated from technote-space/gh-actions-template
-
-
Notifications
You must be signed in to change notification settings - Fork 6
49 lines (47 loc) · 1.61 KB
/
add-release-tag.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
on:
pull_request:
branches:
- master
types: [closed]
name: Add release tag
jobs:
tag:
name: Add release tag
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true && github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/')
steps:
- uses: technote-space/load-config-action@v1
with:
CONFIG_FILENAME: workflow-settings.json
- name: Get version
uses: technote-space/get-next-version-action@v1
with:
EXCLUDE_MESSAGES: ${{ env.EXCLUDE_MESSAGES }}
if: "! startsWith(github.head_ref, 'release/v')"
- name: Get version
run: echo "::set-env name=NEXT_VERSION::${HEAD_REF#release/}"
env:
HEAD_REF: ${{ github.head_ref }}
if: startsWith(github.head_ref, 'release/v')
- uses: actions/github-script@0.4.0
with:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/${process.env.NEXT_VERSION}`,
sha: context.sha
})
if: env.NEXT_VERSION
- uses: actions/github-script@0.4.0
with:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/heads/release/next-${process.env.NEXT_VERSION}`,
sha: context.sha
})
if: env.NEXT_VERSION