-
Notifications
You must be signed in to change notification settings - Fork 577
89 lines (84 loc) · 3.11 KB
/
prepare-package-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
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
name: Prepare Package Release
on:
workflow_dispatch:
inputs:
version:
description: Use this to provide a version, instead of deriving it from the changelog.
required: false
type: string
package:
description: 'Package'
required: true
default: 'realm'
type: choice
options:
- '@realm/babel-plugin'
- '@realm/common'
- '@realm/react'
- '@realm/tools'
- '@realm/web'
- '@realm/fetch'
jobs:
prepare-package-release:
runs-on: ubuntu-latest
steps:
- run: echo "Preparing release for ${{inputs.package}}"
- uses: kanga333/variable-mapper@v0.3.0
name: Map package to environment variables
with:
key: "${{inputs.package}}"
map: |
{
"@realm/babel-plugin": {
"PACKAGE_PATH": "packages/babel-plugin",
"PACKAGE_NAME": "@realm/babel-plugin",
"VERSION_PREFIX": "babel-plugin-"
},
"@realm/common": {
"PACKAGE_PATH": "packages/realm-common",
"PACKAGE_NAME": "@realm/common",
"VERSION_PREFIX": "realm-common-"
},
"@realm/react": {
"PACKAGE_PATH": "packages/realm-react",
"PACKAGE_NAME": "@realm/react",
"VERSION_PREFIX": "realm-react-"
},
"@realm/tools": {
"PACKAGE_PATH": "packages/realm-tools",
"PACKAGE_NAME": "@realm/tools",
"VERSION_PREFIX": "realm-tools-"
},
"@realm/web": {
"PACKAGE_PATH": "packages/realm-web",
"PACKAGE_NAME": "realm-web",
"VERSION_PREFIX": "realm-web-"
},
"@realm/fetch": {
"PACKAGE_PATH": "packages/fetch",
"PACKAGE_NAME": "@realm/fetch",
"VERSION_PREFIX": "realm-fetch-"
}
}
- name: Checkout Code
uses: actions/checkout@v4
# action is at https://github.com/realm/ci-actions/tree/main/update-changelog
- name: Update Changelog
id: update-changelog
uses: realm/ci-actions/update-changelog@main
with:
version: ${{ inputs.version }}
changelog: ${{ github.workspace }}/${{env.PACKAGE_PATH}}/CHANGELOG.md
- name: Update package.json
working-directory: ${{ github.workspace }}/${{env.PACKAGE_PATH}}
run: |
npm version ${{ steps.update-changelog.outputs.new-version }}
- name: Create Release PR
uses: peter-evans/create-pull-request@v4
with:
branch: release/${{env.VERSION_PREFIX}}${{ steps.update-changelog.outputs.new-version }}
title: Prepare for ${{env.VERSION_PREFIX}}${{ steps.update-changelog.outputs.new-version }}
body: An automated PR for next release.
commit-message: "[${{env.VERSION_PREFIX}}${{ steps.update-changelog.outputs.new-version }}] Bump version"
token: ${{ secrets.REALM_CI_PAT }}
labels: no-jira-ticket