-
Notifications
You must be signed in to change notification settings - Fork 2.9k
71 lines (63 loc) · 2.31 KB
/
Copy pathchange-prerelease-tag.yml
File metadata and controls
71 lines (63 loc) · 2.31 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
name: Change Prerelease Tag
on:
workflow_dispatch:
inputs:
branch:
description: "Branch name"
type: string
default: "release-"
required: true
tag:
description: "New tag name"
type: string
default: "rc"
required: true
jobs:
change_prerelease_tag:
name: Changesets Update Prerelease Tag
runs-on: ubuntu-latest
# Allow GITHUB_TOKEN to have write permissions
permissions:
contents: write
steps:
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3
id: github-actions-bot-app-token
with:
app-id: 819772
private-key: ${{ secrets.APOLLO_GITHUB_ACTIONS_BOT_PRIVATE_KEY }}
# Check out the repository, using the Github Actions Bot app's token so
# that we can push later.
- name: Checkout repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7
with:
token: ${{ steps.github-actions-bot-app-token.outputs.token }}
# Checkout release branch entered when workflow was kicked off
ref: ${{ github.event.inputs.branch }}
# Fetch entire git history so Changesets can generate changelogs
# with the correct commits
fetch-depth: 0
# We want to commit back further down.
persist-credentials: true
- name: Setup Node.js
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: ">=23.6.0"
- name: Write latest version to package.json and package-lock.json
run: |
version=$(npm show @apollo/client version)
npm pkg set version="$version"
npm i
- name: Update prerelease tag in .changeset/pre.json
uses: restackio/update-json-file-action@6f50afee9a03a456a30cd574123db793319f7544 # 2.1
with:
file: .changeset/pre.json
fields: '{"tag": "${{github.event.inputs.tag}}"}'
- name: Commit and push changes
env:
TAG: ${{ github.event.inputs.tag }}
run: |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
git commit -m "Prepare for "$TAG" release"
git push