-
Notifications
You must be signed in to change notification settings - Fork 4
142 lines (121 loc) · 4.55 KB
/
publish-package.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
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
131
132
133
134
135
136
137
138
139
140
141
142
name: Release @takuma-ru/auto-story-generator package
run-name: Release ${{ inputs.releaseLevel }} version
on:
workflow_dispatch:
inputs:
releaseLevel:
description: "Release level"
required: true
default: "patch(0.0.X)"
type: choice
options:
- major(X.0.0)
- minor(0.X.0)
- patch(0.0.X)
isBeta:
description: "Is beta release (exp: X.X.X-beta.0)"
required: false
type: boolean
isBetaVersionUp:
description: "Is beta version up (exp: X.0.0-beta.X <= here!!)"
required: false
type: boolean
jobs:
release:
runs-on: ubuntu-latest
permissions:
actions: write
checks: write
contents: write
deployments: write
issues: write
packages: write
pull-requests: write
repository-projects: write
security-events: write
statuses: write
environment:
name: Publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NODE_OPTIONS: --max_old_space_size=8192
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set git config
run: |
git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: "package.json"
registry-url: "https://registry.npmjs.org/"
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 8.14.1
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install Node Dependencies
run: pnpm install
- name: Set .npmrc
run: echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > packages/auto-story-generator/.npmrc
#- name: Create release branch
# id: create_branch
# run: |
# git checkout -b release
# git push --set-upstream origin release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Major release
id: major
run: pnpm asg publish:major
if: contains(inputs.releaseLevel, 'major(X.0.0)') && contains(inputs.isBeta, 'false') && contains(inputs.isBetaVersionUp, 'false')
- name: Major Beta release
id: major-beta
run: pnpm asg publish:major-beta
if: contains(inputs.releaseLevel, 'major(X.0.0)') && contains(inputs.isBeta, 'true') && contains(inputs.isBetaVersionUp, 'false')
- name: Minor release
id: minor
run: pnpm asg publish:minor
if: contains(inputs.releaseLevel, 'minor(0.X.0)') && contains(inputs.isBeta, 'false') && contains(inputs.isBetaVersionUp, 'false')
- name: Minor Beta release
id: minor-beta
run: pnpm asg publish:minor-beta
if: contains(inputs.releaseLevel, 'minor(0.X.0)') && contains(inputs.isBeta, 'true') && contains(inputs.isBetaVersionUp, 'false')
- name: Patch release
id: patch
run: pnpm asg publish:patch
if: contains(inputs.releaseLevel, 'patch(0.0.X)') && contains(inputs.isBeta, 'false') && contains(inputs.isBetaVersionUp, 'false')
- name: Patch Beta release
id: patch-beta
run: pnpm asg publish:patch-beta
if: contains(inputs.releaseLevel, 'patch(0.0.X)') && contains(inputs.isBeta, 'true') && contains(inputs.isBetaVersionUp, 'false')
- name: Beta version up
id: beta-version-up
run: pnpm asg publish:prerelease
if: contains(inputs.isBeta, 'false') && contains(inputs.isBetaVersionUp, 'true')
#- name: Create Pull Request
# uses: peter-evans/create-pull-request@v4
# if: steps.major.conclusion == 'success' || steps.minor.conclusion == 'success' || steps.patch.conclusion == 'success' || steps.major-beta.conclusion == 'success' || steps.minor-beta.conclusion == 'success' || steps.patch-beta.conclusion == 'success'
# with:
# title: "Update package.json"
# draft: false
# base: main
# branch: release
# assignees: "${{ github.actor }}"