-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (81 loc) · 2.67 KB
/
publish-packages.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: Publish Packages
on:
workflow_dispatch:
inputs:
version:
type: choice
description: Choose version
options:
- minor
- major
- patch
commit-lint:
type: boolean
default: true
description: Publish commit-lint
validation-messages:
type: boolean
default: true
description: Publish validation-messages
linking-tool:
type: boolean
default: false
description: Publish linking-tool
typed-urls:
type: boolean
default: false
description: Publish typed-urls
jobs:
publish_packages:
runs-on: ubuntu-latest
steps:
- uses: pnpm/action-setup@v2
with:
version: 8.11.0
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '16.x'
registry-url: 'https://registry.npmjs.org'
scope: '@house-of-angular'
env:
NODE_AUTH_TOKEN: test
- name: Install Dependencies
run: pnpm install
- name: Set up inputs as env variables
run: |
echo "COMMIT_LINT=${{ github.event.inputs.commit-lint }}" >> $GITHUB_ENV
echo "VALIDATION_MESSAGES=${{ github.event.inputs.validation-messages }}" >> $GITHUB_ENV
echo "TYPED_URLS=${{ github.event.inputs.typed-urls }}" >> $GITHUB_ENV
echo "LINKING_TOOL=${{ github.event.inputs.linking-tool }}" >> $GITHUB_ENV
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV
- name: Prepare chosen packages
run: |
packages=("commit-lint" "typed-urls" "validation-messages" "linking-tool")
inputs=($COMMIT_LINT $TYPED_URLS $VALIDATION_MESSAGES $LINKING_TOOL)
counter=0
for package in ${packages[@]}; do
if [[ "${inputs[$counter]}" == "false" ]]; then
unset packages[$counter]
fi
counter=$((counter+1))
done
echo "CHOSEN_PACKAGES=${packages[@]}" >> $GITHUB_ENV
- name: Build chosen packages
run: |
for package in ${CHOSEN_PACKAGES[@]}; do
pnpm run build:package $package
done
- name: Bump version and publish
run: |
for package in ${CHOSEN_PACKAGES[@]}; do
cd ./dist/projects/$package
echo "Update $package version..."
pnpm version $VERSION -m "Upgrade $package to %s"
echo "Publishing $package..."
pnpm publish --access=public --tag=latest
cd ../../..
done
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}