generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (47 loc) · 1.42 KB
/
version-up.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 up
on:
workflow_dispatch:
inputs:
semantic:
description: Semantic versioning
required: true
default: patch
type: choice
options:
- major
- minor
- patch
jobs:
version-up:
runs-on: ubuntu-20.04
timeout-minutes: 5
steps:
- uses: actions/checkout@v3
- name: Version up
id: version
run: |
set -x
version=$(npm --no-git-tag-version version $SEMANTIC)
echo "::set-output name=version::${version}"
sed -i -e "s|${GITHUB_REPOSITORY}@v[.0-9]\+|${GITHUB_REPOSITORY}@${version}|g" README.md
git diff
env:
SEMANTIC: ${{ github.event.inputs.semantic }}
- uses: snow-actions/git-config-user@v1.0.0
- id: generate_token
uses: tibdex/github-app-token@v1.5.2
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Commit & PR
run: |
set -x
branch="release/${VERSION}"
git switch -c ${branch}
git add .
git commit -m "${VERSION}"
git push origin ${branch}
gh pr create --base ${GITHUB_REF_NAME} --head ${branch} --assignee ${GITHUB_ACTOR} --title ${VERSION} --body ''
env:
VERSION: ${{ steps.version.outputs.version }}
GH_TOKEN: ${{ steps.generate_token.outputs.token }}