-
Notifications
You must be signed in to change notification settings - Fork 15
154 lines (133 loc) · 5.24 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
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'' }}"}]'