-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (119 loc) · 3.84 KB
/
reusable-js-version.yaml
File metadata and controls
130 lines (119 loc) · 3.84 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Reusable JS/TS version bump & create PR
on:
workflow_call:
inputs:
appId:
description: 'github app id'
required: true
type: string
node-version:
description: 'Node version to run this workflow. Default: 19 as it is in action cache'
default: '22'
required: false
type: string
workingDirectory:
description: Working direction for action
default: ./
type: string
required: false
reviewerUsername:
description: Default reviewer
default: Xyzcancer
type: string
required: false
exclude:
description: Exclude to bump
default: '.'
type: string
required: false
checkChanges:
description: Should run 'yarn --since'?
required: false
type: string
default: 'true'
private:
description: Should apply only to private?
required: false
type: string
default: 'false'
secrets:
appSecret:
required: true
jobs:
run:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- name: debug git vars
run: |
echo "${{ github.event_name }}"
echo "${{ github.event.pull_request.head.ref }}"
echo "${{ github.ref }}"
- name: Start JS action
id: start
uses: rees46/workflow/.github/actions/js/start-js@master
with:
appId: ${{ inputs.appId }}
appSecret: ${{ secrets.appSecret }}
- name: Find last tag commit
id: lastTagCommit
uses: rees46/workflow/.github/actions/git/find-last-tag-commit@master
- name: Bump version
uses: rees46/workflow/.github/actions/js/version-js@master
with:
checkChanges: ${{ inputs.checkChanges }}
private: ${{ inputs.private }}
token: ${{ steps.start.outputs.token }}
baseCommit: ${{ steps.lastTagCommit.outputs.lastTagCommit }}
exclude: ${{ inputs.exclude }}
- name: Generate changelog
uses: rees46/workflow/.github/actions/js/generate-changelog@master
with:
githubToken: ${{ steps.start.outputs.token }}
baseCommit: ${{ steps.lastTagCommit.outputs.lastTagCommit }}
exclude: ${{ inputs.exclude }}
- uses: docker://ghcr.io/codfish/semantic-release-action:v3
id: semanticReleaseStep
env:
GH_TOKEN: ${{ inputs.githubToken || steps.start.outputs.token || secrets.GITHUB_TOKEN }}
with:
plugins: |
[
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
'@semantic-release/npm',
[
'@semantic-release/github',
{
'successComment': false,
'releasedLabels': false
},
]
]
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'master',
'stage'
]
- name: Check release published
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${NEW_RELEASE_PUBLISHED}" != "true" ]; then
echo "New release not published, cancel workflow"
gh run cancel ${{ github.run_id }}
fi
- name: Debug git diff
id: git_diff
run: |
git diff --quiet || echo "has_changes=true" >> "$GITHUB_OUTPUT"
- uses: rees46/workflow/.github/actions/release/prepare-pr@master
if: steps.git_diff.outputs.has_changes == 'true'
with:
reviewerUsername: ${{ inputs.reviewerUsername }}
githubToken: ${{ steps.start.outputs.token }}
releaseVersion: ${{ steps.semanticReleaseStep.outputs.release-version }}