-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (44 loc) · 1.9 KB
/
tagging.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
name: "Version Tagging"
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *' # Everyday at midnight
pull_request:
types: [ closed ]
permissions:
id-token: write
contents: write
jobs:
tagging:
name: "Version Tag"
if: github.event.action != 'closed' || (github.event.pull_request.merged && contains(github.event.pull_request.labels.*.name, 'bump-version-after-merge'))
runs-on: ubuntu-22.04
steps:
- name: Generate github token
id: generate-token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 # pin@v1
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_PRIVATE_KEY }}
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # pin@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ steps.generate-token.outputs.token }}
- name: Bump version and push tag
id: tagging
uses: mathieudutour/github-tag-action@fcfbdceb3093f6d85a3b194740f8c6cec632f4e2 # [email protected]
with:
github_token: ${{ steps.generate-token.outputs.token }}
release_branches: 'main'
default_bump: ${{ github.event_name == 'workflow_dispatch' && 'patch' || false}}
- name: Update version file
if: steps.tagging.outputs.new_version && steps.tagging.outputs.new_version != 'undefined'
run: echo "${{ steps.tagging.outputs.new_version }}" > VERSION
- name: Create a GitHub release
uses: ncipollo/release-action@a2e71bdd4e7dab70ca26a852f29600c98b33153e # pin@v1
if: steps.tagging.outputs.new_version && steps.tagging.outputs.new_version != 'undefined'
with:
tag: ${{ steps.tagging.outputs.new_tag }}
name: Release ${{ steps.tagging.outputs.new_tag }}
body: ${{ steps.tagging.outputs.changelog }}
token: ${{ steps.generate-token.outputs.token }}