generated from layer5io/layer5-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 99
81 lines (69 loc) · 2.75 KB
/
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
name: Version and Publish to NPM
on:
workflow_dispatch:
inputs:
version:
description: 'Specify the version type (path, minor, major)'
required: true
default: 'patch'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18
registry-url: "https://registry.npmjs.org"
scope: "@layer5"
- name: Install deps and build
run: |
yarn
yarn build-all
- name: Initialize the NPM config
run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_AUTH: ${{ secrets.GH_TOKEN }}
- name: Initialize Git User
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor}}@users.noreply.github.com"
- name: Identify changed packages
id: changed-packages
run: |
echo "Changed packages: $(yarn lerna changed --json | jq -r '.[].name')"
- name: Check if there are changed packages
run: |
echo "Changed packages: ${{ steps.changed-packages.outputs.changed-packages }}"
if: steps.changed-packages.outputs.changed-packages != ''
- name: Version packages
run: |
if [ "${{ github.event.inputs.version }}" != 'none' ]; then
./scripts/version-release.sh "${{ steps.changed-packages.outputs.changed-packages }}"
else
echo "Skipping versioning based on input."
fi
- name: Commit changes
run: |
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "chore: publish"
git push origin HEAD
else
echo "No changes to commit."
fi
- name: Create Git tags
run: ./scripts/create-multiple-git-tag.sh
- name: Publish packages
run: make publish-ci
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
GITHUB_AUTH: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}