-
Notifications
You must be signed in to change notification settings - Fork 27
64 lines (57 loc) · 2.3 KB
/
sync-themes-branch-with-themes-tag.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
name: Publish to themes target tag based off of themes branch name
on:
push:
branches:
# only run on branch names that match:
# arc-themes-release-version-{numbers}.{numbers} per product
- arc-themes-release-version-[0-9]+\.[0-9]+
# arc-themes-release-version-{numbers}.{numbers}.{numbers} per product
- arc-themes-release-version-[0-9]+\.[0-9]+\.[0-9]+
# only run on changes to these files
paths:
- "**.js"
- "**.json"
- "**.jsx"
- "**.scss"
- "**/intl.json"
- "**/README.md"
jobs:
publish:
runs-on: ubuntu-latest
env:
SYNCED_RELEASE_TAG: ${{ github.ref_name }} # targets branch name ref_name
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
# pulls all tags (needed for lerna / semantic release to correctly version)
- name: Pull tags to give lerna access to git info
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
registry-url: "https://npm.pkg.github.com"
- name: Cache Node Modules
id: cache
uses: actions/cache@v3
with:
path: node_modules
key: node-modules-${{ hashFiles('package-lock.json') }}
- name: Clean install (CI) dependencies if lockfile (above) changed
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Run all tests
run: npm run test
# See confluence pages https://arcpublishing.atlassian.net/wiki/spaces/TI/pages/2983788608/How+To+Do+Product-Facing+Tag+Release and https://arcpublishing.atlassian.net/wiki/spaces/TI/pages/3013541978/Github+Actions+for+NodeJS+Standards+Best+Practices for documentation
- name: Publish to target tag based off of branch name
run: |
git config --local user.email "[email protected]"
git config --local user.name "$GITHUB_ACTOR"
npx lerna publish --dist-tag ${{ env.SYNCED_RELEASE_TAG }} --canary --preid ${{ env.SYNCED_RELEASE_TAG }} -y
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}