Skip to content

Commit

Permalink
Use the xoom-platform build workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Zalas <[email protected]>
  • Loading branch information
jakzal committed Oct 13, 2022
1 parent dedc53a commit 93baea2
Showing 1 changed file with 3 additions and 141 deletions.
144 changes: 3 additions & 141 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,144 +11,6 @@ env:

jobs:
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 15
outputs:
xoom_version: ${{ steps.version.outputs.xoom_version }}

steps:
- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-

- name: Determine version
id: version
run: echo "::set-output name=xoom_version::$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"

- name: Build with Maven
run: mvn --batch-mode --update-snapshots -Pgithub-releases install

- name: Publish artifacts
uses: actions/upload-artifact@v2
with:
name: JARs
path: target/*.jar

- name: Notify slack
if: always() && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository_owner == 'vlingo'
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: "${{ job.status == 'success' && 'good' || 'danger' }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ci-cd
SLACK_USERNAME: Bob the Builder
SLACK_ICON: 'https://vlingo.io/wp-content/uploads/cropped-vlingo-favicon-180x180.png'
SLACK_FOOTER: '${{ github.repository }}:${{ steps.version.outputs.xoom_version }}'

deploy-github:
name: Deploy to GitHub
runs-on: ubuntu-latest
needs: build
if: (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && github.repository_owner == 'vlingo'
steps:

- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-

- name: Deploy
run: mvn --batch-mode -DskipTests -DuseGitHubPackages -DsignArtifacts -Pgithub-releases deploy
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Notify slack
if: failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: "${{ job.status == 'success' && 'good' || 'danger' }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ci-cd
SLACK_USERNAME: Suzi the Publisher
SLACK_ICON: 'https://vlingo.io/wp-content/uploads/cropped-vlingo-favicon-180x180.png'
SLACK_FOOTER: '${{ github.repository }}'
SLACK_TITLE: 'GitHub Deployment'
SLACK_MESSAGE: ':rocket: ${{ needs.build.outputs.xoom_version }}'

deploy-central:
name: Deploy to Maven Central
runs-on: ubuntu-latest
needs: build
if: (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && github.repository_owner == 'vlingo'
steps:

- uses: actions/checkout@v2

- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: central-repository-ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Configure an additional Maven repository
run: sed -i'.bkp' -e 's/\(<\/servers>\)/ <server><id>github<\/id><username>\${env.GITHUB_ACTOR}<\/username><password>\${env.GITHUB_TOKEN}<\/password><\/server>\n\1/g' ~/.m2/settings.xml

- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2-

- name: Deploy
run: mvn --batch-mode -DskipTests -DuseSonatype -DsignArtifacts -Pgithub-releases deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

- name: Trigger downstream builds
if: startsWith(github.ref, 'refs/tags/')
run: .github/trigger_deps.sh
env:
RELEASE_GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}

- name: Notify slack
if: startsWith(github.ref, 'refs/tags/') || failure()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_COLOR: "${{ job.status == 'success' && 'good' || 'danger' }}"
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_CHANNEL: ci-cd
SLACK_USERNAME: Suzi the Publisher
SLACK_ICON: 'https://vlingo.io/wp-content/uploads/cropped-vlingo-favicon-180x180.png'
SLACK_FOOTER: '${{ github.repository }}'
SLACK_TITLE: 'Sonatype Deployment'
SLACK_MESSAGE: ':rocket: ${{ needs.build.outputs.xoom_version }}'
name: Build and Deploy
uses: vlingo/xoom-platform/.github/workflows/build.yml@master
secrets: inherit

0 comments on commit 93baea2

Please sign in to comment.