-
-
Notifications
You must be signed in to change notification settings - Fork 83
56 lines (56 loc) · 1.91 KB
/
version.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: Bump Version
on:
workflow_dispatch:
inputs:
type:
description: 'Type of version (`major`, `minor`, `patch`)'
required: true
default: 'patch'
jobs:
bump:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will failed to push refs to dest repo
token: ${{secrets.PAT}} # use a personal acces token so that other actions can trigger
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: '17' # You might need to adjust this value to your own version
- name: Update version
id: version
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
npm config set tag-version-prefix ''
npm version ${{ github.event.inputs.type }}
echo "::set-output name=tag::$(git describe --abbrev=0)"
# update the manifest.json with the tag version
- name: Update manifest version
uses: jossef/action-set-json-field@v1
with:
file: manifest.json
field: version
value: ${{ steps.version.outputs.tag }}
# update the distVersion.json with the tag version
- name: Update dist version
uses: jossef/action-set-json-field@v1
with:
file: distVersion.json
field: version
value: ${{ steps.version.outputs.tag }}
- name: Commit manifest
run: |
git branch --show-current
git add -u
git commit --amend --no-edit
git tag -fa ${{ steps.version.outputs.tag }} -m "${{ steps.version.outputs.tag }}"
# push the commit
- name: Push changes
uses: ad-m/github-push-action@v0.6.0
with:
github_token: ${{secrets.PAT}}
tags: true
branch: ${{ github.ref }}