-
Notifications
You must be signed in to change notification settings - Fork 3
140 lines (119 loc) · 4.91 KB
/
Copy pathrelease-motion-presets.yml
File metadata and controls
140 lines (119 loc) · 4.91 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
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
name: Motion Presets - Bump Version and Publish
on:
workflow_dispatch:
inputs:
version_strategy:
type: choice
description: Version strategy
options:
- prerelease
- premajor
- preminor
- prepatch
- major
- minor
- patch
dry_run:
description: 'Dry run (preview only)'
required: false
default: false
type: boolean
permissions:
id-token: write # REQUIRED for npm Trusted Publishing
contents: write
pull-requests: write
jobs:
publish:
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0 # full history for yarn version
token: ${{ secrets.GITHUB_TOKEN }}
- name: Create and checkout release branch
if: ${{ github.event.inputs.dry_run == 'false' }}
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git checkout -b release
git push -u origin release
- name: Setup Node with trusted publishing
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 24
registry-url: https://registry.npmjs.org
- name: Set up Yarn
run: |
corepack enable
corepack prepare yarn@4.10.3 --activate
yarn set version 4.10.3
- name: Install dependencies
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: NPQ_PKG_MGR=yarn npx npq install
- name: Build motion-presets package
run: |
yarn workspace @wix/motion build
yarn workspace @wix/motion-presets build
- name: Test motion-presets package
run: yarn workspace @wix/motion-presets test
# ---- BUMP VERSION ----
- name: Bump version
if: ${{ github.event.inputs.dry_run == 'false' }}
working-directory: packages/motion-presets
run: yarn version ${{ github.event.inputs.version_strategy }}
- name: Get new version
if: ${{ github.event.inputs.dry_run == 'false' }}
id: get_version
working-directory: packages/motion-presets
run: |
VERSION=$(node -p "require('./package.json').version")
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Commit and push version bump
if: ${{ github.event.inputs.dry_run == 'false' }}
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add .
git commit -m "chore: bump @wix/motion-presets to ${{ steps.get_version.outputs.version }}"
git tag "motion-presets@${{ steps.get_version.outputs.version }}"
git push --follow-tags origin release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# ---- CREATE PULL REQUEST ----
- name: Create Pull Request
if: ${{ github.event.inputs.dry_run == 'false' }}
id: create_pr
uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { data: pr } = await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: `chore: bump @wix/motion-presets to ${{ steps.get_version.outputs.version }}`,
head: 'release',
base: 'master',
body: 'Automated version bump and release PR',
maintainer_can_modify: true
});
return pr.number;
# ---- PUBLISH WITH TRUSTED PUBLISHING ----
- name: npm publish @wix/motion-presets RC (trusted)
if: ${{ github.event.inputs.dry_run == 'false' && (github.event.inputs.version_strategy == 'prerelease' || github.event.inputs.version_strategy == 'premajor' || github.event.inputs.version_strategy == 'preminor' || github.event.inputs.version_strategy == 'prepatch') }}
run: |
cd packages/motion-presets
npm publish --tag next --provenance --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.RELEASE_MOTION_PRESETS_NPM_TOKEN }}
- name: npm publish @wix/motion-presets Stable (trusted)
if: ${{ github.event.inputs.dry_run == 'false' && (github.event.inputs.version_strategy == 'major' || github.event.inputs.version_strategy == 'minor' || github.event.inputs.version_strategy == 'patch') }}
run: |
cd packages/motion-presets
npm publish --tag latest --provenance --access=public
env:
NODE_AUTH_TOKEN: ${{ secrets.RELEASE_MOTION_PRESETS_NPM_TOKEN }}
# Merging back to master currently doesn't work, will be done manually