-
Notifications
You must be signed in to change notification settings - Fork 5
51 lines (44 loc) · 1.42 KB
/
release.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
name: Release
on:
push:
branches:
- production
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
packages: write
pull-requests: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: '20.x'
- name: Ensure main is present for the commit message preparation
run: |
git checkout main
git checkout production
- name: Prepare for the commit message
run: |
echo "NEW_VERSION=$(pnpm changeset status --output=release.json > /dev/null && jq -r '.releases[0].newVersion' release.json && rm release.json)" >> "$GITHUB_ENV"
- name: Publish
id: changesets
uses: changesets/action@v1
with:
version: pnpm changeset:version
publish: pnpm changeset publish
title: 'Release v${{ env.NEW_VERSION }}'
commit: 'Release v${{ env.NEW_VERSION }}'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create PR to merge production to main
if: steps.changesets.outputs.published == 'true'
run: gh pr create -B main -H production --title 'Merge production to main' --reviewer bbenligiray
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}