-
Notifications
You must be signed in to change notification settings - Fork 1
83 lines (72 loc) · 2.9 KB
/
bump-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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Bump version Publish NT CSS Framework
on:
workflow_dispatch:
inputs:
app:
description: 'App to bump version'
required: true
type: choice
default: nt-stylesheet
options:
- nt-stylesheet
version:
description: 'Semver type of new version (major / minor / patch)'
required: true
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
pull-requests: write
jobs:
bump-version:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install --no-frozen-lockfile
- name: Setup Git
run: |
git config user.name 'khoilen'
git config user.email '[email protected]'
- name: Bump version and push to local branch
id: bump-version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
pnpm version ${{ github.event.inputs.version }} || true
version=$(jq -r '.version' ./package.json)
echo "Bumped version: $version"
echo "new_version=$version" >> $GITHUB_ENV
if [$version != "unknown" ]; then
git checkout -b bump-${{ github.event.inputs.app }}-version-$version
git add .
git commit -m "Bump ${{ github.event.inputs.app }} version to $version"
git tag "v$version"
git push origin bump-${{ github.event.inputs.app }}-version-$version --follow-tags
else
echo "Skipping push due to unknown version"
fi
working-directory: apps/${{ github.event.inputs.app }}
continue-on-error: true
- name: Create Pull Request
if: env.new_version != 'unknown'
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GITHUB_TOKEN }}
base: main
branch: bump-${{ github.event.inputs.app }}-version-${{ env.new_version }}
title: "Bump version to ${{ env.new_version }} for ${{ github.event.inputs.app }}"
body: "This PR bumps the version to ${{ env.new_version }} for ${{ github.event.inputs.app }}."
labels: version-bump
assignees: khoilen
reviewers: khoilen