Release #49
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
name: Release | |
on: | |
workflow_dispatch: | |
branches: ["master"] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: tibdex/github-app-token@v1 | |
id: generate-token | |
with: | |
app_id: ${{ secrets.APP_ID }} | |
private_key: ${{ secrets.APP_PRIVATE_KEY }} | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Set up Java 11 | |
uses: actions/setup-java@v2 | |
with: | |
java-version: 11 | |
distribution: 'zulu' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Run pre release script | |
id: preRelease | |
run: | | |
# export GPG_TTY=$(tty) | |
export MY_POM_VERSION=`mvn -q -Dexec.executable="echo" -Dexec.args='${projects.version}' --non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec` | |
if [[ $MY_POM_VERSION =~ ^.*SNAPSHOT$ ]]; | |
then | |
echo "not releasing snapshot version: " ${MY_POM_VERSION} | |
echo "RELEASE_OK=no" >> $GITHUB_ENV | |
else | |
. ./CI/pre-release.sh | |
echo "RELEASE_OK=yes" >> $GITHUB_ENV | |
fi | |
echo "SC_VERSION=$SC_VERSION" >> $GITHUB_ENV | |
echo "SC_NEXT_VERSION=$SC_NEXT_VERSION" >> $GITHUB_ENV | |
echo "SC_LAST_RELEASE=$SC_LAST_RELEASE" >> $GITHUB_ENV | |
- name: configure git user email | |
run: | | |
git config --global user.email "action@github.com" | |
git config --global user.name "GitHub Action" | |
git config --global hub.protocol https | |
git remote set-url origin https://\${{ secrets.GITHUB_TOKEN }}:x-oauth-basic@github.com/swagger-api/swagger-parser.git | |
- name: Run maven deploy/release (action-maven-publish) | |
uses: samuelmeuli/action-maven-publish@v1 | |
if: env.RELEASE_OK == 'yes' | |
with: | |
gpg_private_key: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }} | |
gpg_passphrase: ${{ secrets.OSSRH_GPG_PRIVATE_PASSPHRASE }} | |
nexus_username: ${{ secrets.OSSRH_USERNAME }} | |
nexus_password: ${{ secrets.OSSRH_TOKEN }} | |
maven_profiles: "release" | |
- name: Run post release script | |
id: postRelease | |
if: env.RELEASE_OK == 'yes' | |
run: | | |
. ./CI/post-release.sh | |
- name: Create Next Snapshot Pull Request | |
uses: peter-evans/create-pull-request@v4 | |
if: env.RELEASE_OK == 'yes' | |
with: | |
token: ${{ steps.generate-token.outputs.token }} | |
commit-message: bump snapshot ${{ env.SC_NEXT_VERSION }}-SNAPSHOT | |
title: 'bump snapshot ${{ env.SC_NEXT_VERSION }}-SNAPSHOT' | |
branch: bump-snap-${{ env.SC_NEXT_VERSION }}-SNAPSHOT | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
SC_VERSION: | |
SC_NEXT_VERSION: | |
GPG_PRIVATE_KEY: ${{ secrets.OSSRH_GPG_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_PRIVATE_PASSPHRASE }} |