-
Notifications
You must be signed in to change notification settings - Fork 23
145 lines (119 loc) · 5.14 KB
/
cd-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
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
# Copyright 2023 asyncer.io proejcts
#
# Licensed 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:
workflow_dispatch:
jobs:
prepare:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set Up Java 8
uses: actions/setup-java@v3
with:
distribution: 'temurin' # gh runner local caches lts temurins
java-version: '8'
- name: Setup Git Configs
run: |
git config --global user.email "asyncer-io-bot@users.noreply.github.com"
git config --global user.name "asyncer-io-bot"
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Cache & Load Local Maven Repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-prepare-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-prepare-
- name: DryRun Release Prepare
run: |
./mvnw -B -ntp -pl r2dbc-mysql release:prepare -DpreparationGoals=clean -DdryRun=true -DskipTests=true
- name: Upgrade Native Image Version
run: ./.github/scripts/upgrade_native_image_version.sh
- name: Run release prepare command
run: |
./mvnw -B -ntp -pl r2dbc-mysql release:prepare -DpreparationGoals=clean -Dresume=false -DskipTests=true
./mvnw -B -ntp clean
- name: Ensure Prepared
run: ./.github/scripts/ensure_prepared.sh
- name: Upload workspace
uses: actions/upload-artifact@v3
with:
name: prepare-workspace
path: ${{ github.workspace }}
- name: Rollback Release
working-directory: ./prepare-workspace/
if: ${{ failure() }}
run: ./.github/scripts/release_rollback.sh ${{ github.ref_name }}
stage-release:
runs-on: ubuntu-latest
needs: prepare
steps:
- name: Download workspace
uses: actions/download-artifact@v3
with:
name: prepare-workspace
path: ./prepare-workspace/
- name: fix permissions
run: |
chmod 755 ./prepare-workspace/mvnw
chmod 755 ./prepare-workspace/.github/scripts/release_rollback.sh
- name: Set up Java 8
uses: actions/setup-java@v3
with:
distribution: 'temurin' # gh runner local caches lts temurins
java-version: '8'
- name: Setup git configs
run: |
git config --global user.email "asyncer-io-bot@users.noreply.github.com"
git config --global user.name "asyncer-io-bot"
- name: Install SSH key0
uses: shimataro/ssh-key-action@v2
with:
key: ${{ secrets.SSH_PRIVATE_KEY }}
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
- name: Cache & Load Local Maven Repository
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-prepare-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-prepare-
- name: Set Up Maven Settings
uses: s4u/maven-settings-action@v2.8.0
with:
servers: |
[{
"id": "ossrh-staging",
"username": "${{ secrets.OSSRH_USERNAME }}",
"password": "${{ secrets.OSSRH_PASSWORD }}"
}]
- name: Create Local Deploy Directory
run: mkdir -p ~/local-staging
- name: Import GPG & Deploy Local Staging
working-directory: ./prepare-workspace/
run: |
cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import
./mvnw -B -ntp -am -pl r2dbc-mysql clean javadoc:jar package gpg:sign org.sonatype.plugins:nexus-staging-maven-plugin:deploy -DnexusUrl=https://s01.oss.sonatype.org -DserverId=ossrh-staging -DaltStagingDirectory=/home/runner/local-staging -DskipRemoteStaging=true -DskipTests=true -Dgpg.passphrase="${{ secrets.GPG_PASSPHRASE }}" -Dgpg.keyname="${{ secrets.GPG_KEY_NAME }}"
- name: Prepare Internal Dependencies
run: ./mvnw -B -ntp -pl build-tools clean install -DskipTests -Dcheckstyle.skip
- name: Deploy Local Staged Artifacts
working-directory: ./prepare-workspace/
run: ./mvnw -B -ntp -pl r2dbc-mysql --file pom.xml org.sonatype.plugins:nexus-staging-maven-plugin:deploy-staged -DnexusUrl=https://s01.oss.sonatype.org -DserverId=ossrh-staging -DaltStagingDirectory=/home/runner/local-staging -DskipStagingRepositoryClose=true -Dcheckstyle.skip
- name: Rollback Release
working-directory: ./prepare-workspace/
if: ${{ failure() }}
run: ./.github/scripts/release_rollback.sh