-
-
Notifications
You must be signed in to change notification settings - Fork 29
48 lines (48 loc) · 1.63 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
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@v1
with:
node-version: '14.x' # You might need to adjust this value to your own version
- name: Update version
id: version
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
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 }}
- 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/[email protected]
with:
github_token: ${{secrets.PAT}}
tags: true
branch: ${{ github.ref }}