forked from wso2/identity-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
186 lines (166 loc) Β· 7.05 KB
/
release-workflow.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# -------------------------------------------------------------------------------------
#
# Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com).
#
# WSO2 LLC. licenses this file to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file except
# in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
# --------------------------------------------------------------------------------------
name: Release
on:
push:
branches: [ master ]
paths-ignore:
- "LICENSE"
workflow_dispatch:
env:
GH_TOKEN: ${{ secrets.RELEASE_BOT_TOKEN }}
SHOULD_GENERATE_CHANGESET: 'true'
BRANCH: master
IS_HOTFIX: 'false'
BOT_USERNAME: ${{ secrets.RELEASE_BOT_USER_NAME }}
BOT_EMAIL: ${{ secrets.RELEASE_BOT_EMAIL }}
jobs:
release:
name: π Release
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [lts/*]
maven-version: [3.8.6]
java-version: [11]
pnpm-version: [8.7.4]
steps:
- name: β¬οΈ Checkout
id: checkout
uses: actions/[email protected]
with:
token: ${{ env.GH_TOKEN }}
fetch-depth: 0
- name: Set up Git user
run: |
git config user.name ${{ env.BOT_USERNAME }}}
git config user.email ${{ env.BOT_EMAIL }}}
- name: π’ Setup node
id: setup-node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- name: β Set up JDK 11
id: jdk-setup
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java-version }}
distribution: "adopt"
cache: maven
- name: 𦩠Set up Maven
uses: stCarolas/setup-maven@v4
id: mvn-setup
with:
maven-version: ${{ matrix.maven-version }}
- name: π₯‘ Setup pnpm
uses: pnpm/[email protected]
with:
version: ${{ matrix.pnpm-version }}
run_install: false
- name: π Get pnpm store directory
id: get-pnpm-cache-dir
run: |
echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
- name: π Cache pnpm modules
uses: actions/cache@v3
id: pnpm-cache
with:
path: ${{ steps.get-pnpm-cache-dir.outputs.pnpm_cache_dir }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 𧩠Install Dependencies
id: install-dependencies
run: pnpm install
- name: π Create settings.xml with Nexus credentials in ~/.m2
run: |
echo '<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>nexus-releases</id>
<username>${{ secrets.NEXUS_USERNAME }}</username>
<password>${{ secrets.NEXUS_PASSWORD }}</password>
</server>
<server>
<id>wso2.releases</id>
<username>${{ secrets.NEXUS_USERNAME }}</username>
<password>${{ secrets.NEXUS_PASSWORD }}</password>
</server>
<server>
<id>wso2.snapshots</id>
<username>${{ secrets.NEXUS_USERNAME }}</username>
<password>${{ secrets.NEXUS_PASSWORD }}</password>
</server>
</servers>
<profiles>
<profile>
<id>include-sources</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</settings>' > ~/.m2/settings.xml
- name: πΎ Cache local Maven repository
id: cache-maven-m2
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: π£ Create Release Pull Request or Publish to npm
if: ${{ env.SHOULD_GENERATE_CHANGESET == 'true' }}
id: changesets
uses: changesets/action@v1
with:
title: "[Release] [GitHub Action] Update package versions"
publish: pnpm publish:packages
version: pnpm version:packages
commit: "[WSO2 Release] [GitHub Action] [Release] [skip ci] update package versions"
env:
GITHUB_TOKEN: ${{ env.GH_TOKEN }}
- name: π· Build Project
if: ${{ env.IS_HOTFIX == 'true' }}
id: build-project
run: pnpm build
- name: π Perform Release
id: perform-release
working-directory: .github/workflows
run: |
PACKAGES="${{ toJson(steps.changesets.outputs.publishedPackages) }}"
bash ./scripts/release.sh "$PACKAGES" ${{ github.run_number }} ${{ env.IS_HOTFIX }}