Skip to content

Commit

Permalink
Minor refactoring to release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sbglasius committed Feb 24, 2022
1 parent 8116b09 commit 1c48ff0
Showing 1 changed file with 87 additions and 63 deletions.
150 changes: 87 additions & 63 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,90 @@
name: Release
on:
release:
types: [ published ]
release:
types: [ published ]
jobs:
release:
runs-on: ubuntu-latest
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Get latest release version number
id: get_version
uses: battila7/get-version-action@v2
- name: Run pre-release
uses: micronaut-projects/github-actions/pre-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Sonatype OSSRH
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
SECRING_FILE: ${{ secrets.SECRING_FILE }}
RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }}
run: |
echo "${SECRING_FILE}" | base64 -d > "${GITHUB_WORKSPACE}/secring.gpg"
echo "Publishing Artifacts for $RELEASE_VERSION"
(set -x; ./gradlew -Pversion="${RELEASE_VERSION}" -Psigning.secretKeyRingFile="${GITHUB_WORKSPACE}/secring.gpg" publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon)
- name: Bump patch version by one
uses: actions-ecosystem/action-bump-semver@v1
id: bump_semver
with:
current_version: ${{steps.get_version.outputs.version-without-v }}
level: patch
- name: Set version in gradle.properties
env:
NEXT_VERSION: ${{ steps.bump_semver.outputs.new_version }}
run: |
echo "Preparing next snapshot"
./gradlew snapshotVersion -Pversion="${NEXT_VERSION}"
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
author_name: ${{ secrets.GIT_USER_NAME }}
author_email: $${ secrets.GIT_USER_EMAIL }}
message: 'Set version to next SNAPSHOT'
- name: Export Gradle Properties
uses: micronaut-projects/github-actions/export-gradle-properties@master
- name: Run post-release
if: success()
uses: micronaut-projects/github-actions/post-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
release:
runs-on: ubuntu-latest
env:
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GH_TOKEN }}
- uses: gradle/wrapper-validation-action@v1
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 8
- name: Get latest release version number
id: get_version
uses: battila7/get-version-action@v2
- name: Run pre-release
uses: micronaut-projects/github-actions/pre-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Publish to Sonatype OSSRH
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
SIGNING_PASSPHRASE: ${{ secrets.SIGNING_PASSPHRASE }}
SECRING_FILE: ${{ secrets.SECRING_FILE }}
RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }}
run: |
echo "${SECRING_FILE}" | base64 -d > "${GITHUB_WORKSPACE}/secring.gpg"
echo "Publishing Artifacts for $RELEASE_VERSION"
(set -x; ./gradlew -Pversion="${RELEASE_VERSION}" -Psigning.secretKeyRingFile="${GITHUB_WORKSPACE}/secring.gpg" publishToSonatype closeAndReleaseSonatypeStagingRepository --no-daemon)
- name: Bump patch version by one
uses: actions-ecosystem/action-bump-semver@v1
id: bump_semver
with:
current_version: ${{steps.get_version.outputs.version-without-v }}
level: patch
- name: Set version in gradle.properties
env:
NEXT_VERSION: ${{ steps.bump_semver.outputs.new_version }}
run: |
echo "Preparing next snapshot"
./gradlew snapshotVersion -Pversion="${NEXT_VERSION}"
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
author_name: ${{ secrets.GIT_USER_NAME }}
author_email: $${ secrets.GIT_USER_EMAIL }}
message: 'Set version to next SNAPSHOT'
- name: Check file documentation exists
id: check_documentation
uses: andstor/file-existence-action@v1
with:
files: "src/docs"
- name: Build documentation
if: steps.check_documentation.outputs.files_exists == 'true'
env:
RELEASE_VERSION: ${{ steps.get_version.outputs.version-without-v }}
run: |
./gradlew asciidoctor -Pversion="${RELEASE_VERSION}"
- name: Export Gradle Properties
uses: micronaut-projects/github-actions/export-gradle-properties@master
- name: Publish to Github Pages
if: steps.check_documentation.outputs.files_exists == 'true' && success()
uses: micronaut-projects/github-pages-deploy-action@master
env:
BETA: ${{ steps.get_version.outputs.isPrerelase }}
TARGET_REPOSITORY: ${{ github.repository }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}
BRANCH: gh-pages
FOLDER: build/asciidoc
DOC_FOLDER: latest
COMMIT_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
COMMIT_NAME: ${{ secrets.GIT_USER_NAME }}
VERSION: ${{ steps.get_version.outputs.version-without-v }}
- name: Run post-release
if: success()
uses: micronaut-projects/github-actions/post-release@master
with:
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 1c48ff0

Please sign in to comment.