Release Deploy #101
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 2017 Adobe. All rights reserved. | |
# This file is licensed to you 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 REPRESENTATIONS | |
# OF ANY KIND, either express or implied. See the License for the specific language | |
# governing permissions and limitations under the License. | |
# | |
name: Release Deploy | |
# Run workflow on commits to default branch | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseVersion: | |
description: 'Release version (major.minor.patch)' | |
required: false | |
jobs: | |
tag: | |
runs-on: ubuntu-latest | |
# Only release from main branch | |
if: github.repository == 'adobe/aio-lib-java' && github.ref == 'refs/heads/main' | |
outputs: | |
version: ${{ steps.store-version.outputs.version }} | |
steps: | |
# Check out Git repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Set up environment with Java and Maven | |
- name: Set up JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
cache: maven | |
- name: Initialize mandatory git config | |
run: | | |
git config user.name "GitHub Actions" | |
git config user.email [email protected] | |
- name: Release with Maven | |
run: mvn -B release:clean release:prepare -DreleaseVersion=${{ github.event.inputs.releaseVersion }} | |
- name: Store Version | |
id: store-version | |
run: echo "::set-output name=version::$(grep ^scm.tag= release.properties | sed -e 's/scm.tag=aio-lib-java-//g')" | |
github-release: | |
needs: tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Work around for https://github.com/heinrichreimer/action-github-changelog-generator/issues/21 | |
ref: aio-lib-java-${{ needs.tag.outputs.version }} | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
cache: maven | |
- name: Maven Verify | |
run: mvn -U clean verify | |
- name: Generate Release Changelog | |
id: generate-release-changelog | |
uses: heinrichreimer/[email protected] | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
breakingLabel: '### π₯ Breaking' | |
enhancementLabel: '### π Enhancements' | |
bugsLabel: '### π Bug fixes' | |
securityLabel: '### π‘οΈ Security' | |
issuesLabel: '### π Other issues' | |
prLabel: '### π Other pull requests' | |
addSections: '{"documentation":{"prefix":"### π Documentation","labels":["documentation"]},"tests":{"prefix":"### β Testing","labels":["tests"]}}' | |
issues: false | |
issuesWoLabels: false | |
pullRequests: true | |
prWoLabels: true | |
author: true | |
compareLink: true | |
onlyLastTag: true | |
stripHeaders: true | |
stripGeneratorNotice: true | |
- name: Create Release | |
id: create-release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: aio-lib-java-${{ needs.tag.outputs.version }} | |
release_name: aio-lib-java-${{ needs.tag.outputs.version }} | |
body: ${{ steps.generate-release-changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Artifacts | |
id: upload-release-artifacts | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: aio-lib-java-${{ needs.tag.outputs.version }} | |
files: | | |
target/aio-lib-java-*.pom | |
core/target/aio-lib-java-core-*.jar | |
ims/target/aio-lib-java-ims-*.jar | |
events_mgmt/target/aio-lib-java-events-mgmt-*.jar | |
events_journal/target/aio-lib-java-events-journal-*.jar | |
events_ingress/target/aio-lib-java-events-ingress-*.jar | |
aem/lib_osgi/target/aio-lib-osgi-*.jar | |
aem/core_aem/target/aio-aem-core-*.jar | |
aem/events_mgmt_aem/target/aio-event-management-*.jar | |
aem/events_ingress_aem/target/aio-event-publish-*.jar | |
aem/events_osgi_mapping/target/aio-event-osgimapping-*.jar | |
aem/aio_aem_events/target/aio-aem-events-*.zip | |
additional-release-artifacts-aem: | |
needs: [tag, github-release] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
profile: | |
- 'aem65deps,aem65' | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Work around for https://github.com/heinrichreimer/action-github-changelog-generator/issues/21 | |
ref: aio-lib-java-${{ needs.tag.outputs.version }} | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
cache: maven | |
- name: Maven Verify | |
run: mvn clean verify -P${{ matrix.profile }} | |
- name: Upload Release Artifacts | |
id: upload-release-artifacts | |
uses: softprops/action-gh-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: aio-lib-java-${{ needs.tag.outputs.version }} | |
files: | | |
target/aio-lib-java-*.pom | |
core/target/aio-lib-java-core-*.jar | |
ims/target/aio-lib-java-ims-*.jar | |
events_mgmt/target/aio-lib-java-events-mgmt-*.jar | |
events_journal/target/aio-lib-java-events-journal-*.jar | |
events_ingress/target/aio-lib-java-events-ingress-*.jar | |
aem/lib_osgi/target/aio-lib-osgi-*.jar | |
aem/core_aem/target/aio-aem-core-*.jar | |
aem/events_mgmt_aem/target/aio-event-management-*.jar | |
aem/events_ingress_aem/target/aio-event-publish-*.jar | |
aem/events_osgi_mapping/target/aio-event-osgimapping-*.jar | |
aem/aio_aem_events/target/aio-aem-events-*.zip | |
maven-central-deploy: | |
needs: tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: aio-lib-java-${{ needs.tag.outputs.version }} | |
- name: Setup JDK | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: 11 | |
cache: maven | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_CENTRAL_TOKEN | |
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Import GPG key | |
env: | |
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }} | |
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }} | |
run: | | |
echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes | |
echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes | |
- name: AEM6.5 Build | |
run: mvn clean deploy -DskipRemoteStaging=true -Dmaven.test.skip -Paem65deps,aem65,release | |
env: | |
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: AEMaaCS Build | |
run: mvn clean deploy -DskipRemoteStaging=true -PaemaacsDeps,aemaacs,release,attach-javadoc,attach-source | |
env: | |
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
- name: Deploy to Central | |
run: mvn nexus-staging:deploy-staged -DautoReleaseAfterClose=true | |
env: | |
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |