-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
69 lines (59 loc) · 2.45 KB
/
pre-release.yaml
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
name: Pre-release
on:
push:
branches:
- "beta/release-*"
concurrency: ${{ github.workflow }}-${{ github.ref }}
jobs:
prerelease:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install
uses: ./.github/common-actions/install
- name: Check if pre.json exists
id: check_if_pre_json_exists
uses: andstor/[email protected]
with:
files: ".changeset/pre.json"
- name: Enter pre-release mode
if: "${{ steps.check_if_pre_json_exists.outputs.files_exists == 'false' && !contains(github.event.head_commit.message, 'ci(changesets): exit pre-release mode') }}"
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
npx changeset pre enter beta
git add -A
git commit -m 'chore(pre-release): enter pre-release mode'
git push
- name: Get pre-release changesets
id: pre-release-changesets
uses: notiz-dev/github-action-json-property@release
with:
path: ".changeset/pre.json"
prop_path: "changesets"
- name: Get changesets array length
id: number-of-changesets
run: |
arrayLength=$(echo '${{steps.pre-release-changesets.outputs.prop}}' | jq '. | length')
echo "length=$arrayLength" >> "$GITHUB_OUTPUT"
- name: Create pre-release PR
if: "${{steps.check_if_pre_json_exists.outputs.files_exists == 'true' && !startsWith(github.event.head_commit.message, 'ci(changesets): version packages') && steps.number-of-changesets.outputs.length > 0}}"
uses: changesets/action@v1
with:
version: pnpm version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to NPM
id: publish-beta-to-npm
if: "${{steps.check_if_pre_json_exists.outputs.files_exists == 'true' && startsWith(github.event.head_commit.message, 'ci(changesets): version packages')}}"
uses: changesets/action@v1
with:
publish: pnpm release
title: "ci(changesets): :package: version packages (beta)"
commit: "ci(changesets): version packages (beta)"
setupGitUser: false
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}