Build #2717
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: Build | |
on: | |
push: | |
pull_request: | |
schedule: | |
- cron: '0 4 * * *' | |
jobs: | |
build: | |
name: Build & Deploy | |
runs-on: ubuntu-latest | |
timeout-minutes: 15 | |
services: | |
schemata: | |
image: vlingo/xoom-schemata:latest | |
ports: | |
- "9019:9019" | |
env: | |
XOOM_SCHEMATA_PORT: 9019 | |
XOOM_ENV: dev | |
rabbit: | |
image: "rabbitmq:3" | |
ports: | |
- "5672:5672" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'zulu' | |
cache: 'maven' | |
- name: Build with Maven | |
run: mvn --batch-mode --update-snapshots install -P deployment,frontend,github-releases | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish JARs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: JARs | |
path: target/*.jar | |
- name: Publish designer (tar) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: designer.tar | |
path: dist/designer.tar | |
- name: Publish designer (zip) | |
uses: actions/upload-artifact@v3 | |
with: | |
name: designer.zip | |
path: dist/designer.zip | |
- name: Notify discord | |
if: always() && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) && github.repository_owner == 'vlingo' | |
uses: 'Ilshidur/[email protected]' | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_USERNAME: Bob the Builder | |
DISCORD_EMBEDS: '[{"title":"Build ${{ job.status }}", "description":"[${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})","author": { "icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "${{ github.server_url }}/${{ github.actor }}"},"color":"${{ job.status == ''success'' && ''65280'' || ''16711680'' }}"}]' | |
- name: Cleanup | |
run: rm -rf ~/.m2/repository/io/vlingo | |
release: | |
runs-on: ubuntu-latest | |
name: Release | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: designer.tar | |
path: . | |
- uses: actions/download-artifact@v3 | |
with: | |
name: designer.zip | |
path: . | |
- name: Create the release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
designer.tar | |
designer.zip | |
body: ':robot: Automagically created release.' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
docker: | |
name: Build Docker image | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Determine the version | |
id: version | |
run: | | |
DOCKER_IMAGE=vlingo/xoom-designer | |
VERSION=snapshot | |
TAGS="${DOCKER_IMAGE}:${VERSION}" | |
if [[ $GITHUB_REF == refs/tags/* ]]; then | |
VERSION=${GITHUB_REF#refs/tags/} | |
TAGS="${DOCKER_IMAGE}:snapshot,${DOCKER_IMAGE}:latest,${DOCKER_IMAGE}:${VERSION}" | |
fi | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
echo "tags=${TAGS}" >> $GITHUB_OUTPUT | |
echo "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT | |
echo "push=${{ (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master') && github.repository_owner == 'vlingo' }}" >> $GITHUB_OUTPUT | |
- uses: actions/download-artifact@v3 | |
with: | |
name: designer.tar | |
path: dist/ | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to DockerHub | |
if: steps.version.outputs.push == 'true' | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build & Push | |
uses: docker/build-push-action@v3 | |
with: | |
context: . | |
push: ${{ steps.version.outputs.push }} | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.version.outputs.tags }} | |
labels: | | |
org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
org.opencontainers.image.created=${{ steps.version.outputs.created }} | |
org.opencontainers.image.revision=${{ github.sha }} | |
- name: Notify discord | |
if: failure() && steps.version.outputs.push == 'true' | |
uses: 'Ilshidur/[email protected]' | |
env: | |
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} | |
DISCORD_USERNAME: Suzi the Publisher | |
DISCORD_EMBEDS: '[{"title":"Docker Image Build ${{ job.status }}", "description":":rocket: [${{ github.repository }}:${{ steps.version.outputs.xoom_version }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})","author": { "icon_url": "https://avatars.githubusercontent.com/${{ github.actor }}", "name": "${{ github.actor }}", "url": "${{ github.server_url }}/${{ github.actor }}"},"color":"${{ job.status == ''success'' && ''65280'' || ''16711680'' }}"}]' |