RELEASE #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 | |