-
Notifications
You must be signed in to change notification settings - Fork 21
135 lines (112 loc) · 4.68 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
# 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 "[email protected]"
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: Run release prepare command
run: |
./mvnw -B -ntp --file pom.xml release:prepare -DpreparationGoals=clean -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 "[email protected]"
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/[email protected]
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 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: Deploy Local Staged Artifacts
working-directory: ./prepare-workspace/
run: ./mvnw -B -ntp --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
- name: Rollback Release
working-directory: ./prepare-workspace/
if: ${{ failure() }}
run: ./.github/scripts/release_rollback.sh