-
Notifications
You must be signed in to change notification settings - Fork 16
111 lines (91 loc) · 4.22 KB
/
promote.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
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
name: Promote release
env:
lerna: '[email protected]'
on:
workflow_dispatch:
inputs:
version:
description: 'Version to promote'
required: true
referenceBranch:
description: 'Branch to be updated after the promotion'
required: true
default: 'maintenance-3.0.x'
dryRun:
description: 'Run the workflow without pushing code or publishing artifacts'
type: boolean
required: false
jobs:
promote:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: 'https://packages.nuxeo.com/repository/npm-public/'
scope: '@nuxeo'
- uses: actions/checkout@v2
with:
ref: v${{ github.event.inputs.version }}
- run: git config user.name "nuxeo-webui-jx-bot" && git config user.email "[email protected]"
- run: echo "VERSION=$(echo '${{ github.event.inputs.version }}' | sed -e 's/-rc.[0-9]*//')" >> $GITHUB_ENV
- name: Update Nuxeo Elements version to ${{ env.VERSION }}
run: |
npm version $VERSION --no-git-tag-version
echo $lerna_version
npx $lerna version $VERSION --no-push --force-publish --no-git-tag-version --yes
- name: Tag Nuxeo Elements v${{ env.VERSION }}
run: |
git commit -a -m "Release $VERSION"
git tag -a v$VERSION -m "Release $VERSION"
- if: ${{ github.event.inputs.dryRun == 'false' }}
run: git push origin v$VERSION
- name: Create Github release v${{ env.VERSION }}
if: ${{ github.event.inputs.dryRun == 'false' }}
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ env.VERSION }}
release_name: Release ${{ env.VERSION }}
- name: Publish to https://packages.nuxeo.com/repository/npm-public/ (dry run)
if: ${{ github.event.inputs.dryRun == 'true' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
run: |
npx $lerna exec --ignore @nuxeo/nuxeo-elements-storybook -- npm publish --@nuxeo:registry=https://packages.nuxeo.com/repository/npm-public/ --dry-run
- name: Publish to https://packages.nuxeo.com/repository/npm-public/
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PACKAGES_TOKEN }}
run: |
npx $lerna exec --ignore @nuxeo/nuxeo-elements-storybook -- npm publish --@nuxeo:registry=https://packages.nuxeo.com/repository/npm-public/
- name: Publish to https://registry.npmjs.org (dry run)
if: ${{ github.event.inputs.dryRun == 'true' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
run: |
npx $lerna exec --ignore @nuxeo/nuxeo-elements-storybook -- npm publish --@nuxeo:registry=https://registry.npmjs.org/ --access public --dry-run
- name: Publish to https://registry.npmjs.org
continue-on-error: true
if: ${{ github.event.inputs.dryRun == 'false' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_REGISTRY_TOKEN }}
run: |
npx $lerna exec --ignore @nuxeo/nuxeo-elements-storybook -- npm publish --@nuxeo:registry=https://registry.npmjs.org/ --access public
- uses: actions/checkout@v2
with:
token: ${{ secrets.GIT_ADMIN_TOKEN }}
ref: ${{ github.event.inputs.referenceBranch }}
- if: ${{ github.event.inputs.referenceBranch == 'master' }}
run: echo "NEW_VERSION=$(npx semver -i minor $VERSION)-SNAPSHOT" >> $GITHUB_ENV
- if: ${{ github.event.inputs.referenceBranch != 'master' }}
run: echo "NEW_VERSION=$(npx semver -i patch $VERSION)-SNAPSHOT" >> $GITHUB_ENV
- name: Align ${{ github.event.inputs.referenceBranch }} branch on next version ${{ env.NEW_VERSION }}
run: |
npm version $NEW_VERSION --no-git-tag-version
npx $lerna version $NEW_VERSION --no-push --force-publish --no-git-tag-version --yes
# commit and push
git commit -a -m "Update to $NEW_VERSION"
- if: ${{ github.event.inputs.dryRun == 'false' }}
run: git push origin ${{ github.event.inputs.referenceBranch }}