forked from kiali/core-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
109 lines (106 loc) · 3.74 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
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
name: Release
on:
workflow_dispatch:
inputs:
release_type:
description: Release type
required: true
default: "minor"
type: choice
options:
- major
- minor
- patch
release_branch:
description: Branch to release
required: true
default: main
type: string
permissions:
actions: write
contents: write
jobs:
initialize:
name: Initialize
runs-on: ubuntu-20.04
outputs:
release_type: ${{ env.release_type }}
release_branch: ${{ env.release_branch }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.release_branch || github.ref_name }}
token: ${{ secrets.KIALI_PROJECT_TOKEN || github.token }}
- name: Configure git
run: |
git config user.email '[email protected]'
git config user.name 'kialiProject'
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: "14"
cache: yarn
cache-dependency-path: yarn.lock
- name: Install dependencies and build 🔧
working-directory: ./packages/types
run: yarn install && yarn build
- name: Major release
if: "${{ github.event.inputs.release_type == 'major' }}"
working-directory: ./packages/types
run: yarn version --major --no-git-tag-version
- name: Minor release
if: "${{ github.event.inputs.release_type == 'minor' }}"
working-directory: ./packages/types
run: yarn version --minor --no-git-tag-version
- name: Patch release
if: "${{ github.event.inputs.release_type == 'patch' }}"
working-directory: ./packages/types
run: yarn version --patch --no-git-tag-version
- name: Get version Types
working-directory: ./packages/types
run : |
echo "NEW_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Publish package types 📦
working-directory: ./packages/types
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish --no-verify-access
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Update package core-ui with new types version
working-directory: ./packages/core-ui
run: yarn upgrade @kiali/types@$NEW_VERSION
- name: Install dependencies and build 🔧
working-directory: ./packages/core-ui
run: yarn install && yarn build
- name: Major release
if: "${{ github.event.inputs.release_type == 'major' }}"
working-directory: ./packages/core-ui
run: yarn version --major --no-git-tag-version
- name: Minor release
if: "${{ github.event.inputs.release_type == 'minor' }}"
working-directory: ./packages/core-ui
run: yarn version --minor --no-git-tag-version
- name: Patch release
if: "${{ github.event.inputs.release_type == 'patch' }}"
working-directory: ./packages/core-ui
run: yarn version --patch --no-git-tag-version
- name: Get version Types
working-directory: ./packages/core-ui
run : |
echo "NEW_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_ENV
- name: Publish package core-ui 📦
working-directory: ./packages/core-ui
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm publish --no-verify-access
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push changes to repository
run: |
git add "./packages/types/package.json"
git add "./packages/core-ui/package.json"
git commit -m "chore: release ${{ env.NEW_VERSION }}"
git tag ${{ env.NEW_VERSION }}
git push origin && git push --tags