-
Notifications
You must be signed in to change notification settings - Fork 461
68 lines (63 loc) · 2.19 KB
/
publish-docker-image-on-release.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
name: Build/Push dotCMS docker image (on release)
on:
# push:
# branches:
# - release-*
repository_dispatch:
types:
- enterprise-update
jobs:
prepare-build:
name: Prepare build
runs-on: ubuntu-latest
outputs:
build_id: ${{ steps.process-params.outputs.build_id }}
steps:
- run: echo 'GitHub context'
env:
GITHUB_CONTEXT: ${{ toJson(github) }}
- name: Process Params
id: process-params
run: |
if [[ "${{ github.event_name }}" == 'repository_dispatch' ]]; then
build_id=${{ github.event.client_payload.build_id }}
else
build_id=$(basename "${{ github.ref }}")
fi
if [[ -z "${build_id}" ]]; then
echo 'Could not resolve build_id, aborting'
exit 1
else
echo "Found build_id: ${build_id}"
fi
echo "build_id=${build_id}" >> $GITHUB_OUTPUT
build-push-image:
name: Build/Push Image
needs: prepare-build
uses: ./.github/workflows/maven-build-docker-image.yml
with:
ref: ${{ needs.prepare-build.outputs.build_id }}
docker_platforms: linux/amd64,linux/arm64
force_snapshot: true
secrets:
docker_io_username: ${{ secrets.DOCKER_USERNAME }}
docker_io_token: ${{ secrets.DOCKER_TOKEN }}
ghcr_io_username: ${{ secrets.DOCKER_USERNAME }}
ghcr_io_token: ${{ secrets.GHCR_TOKEN }}
finish-build-push:
name: Finish Build/Push
needs: build-push-image
runs-on: ubuntu-latest
steps:
- name: Slack Notification
if: success()
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.DEVELOPERS_SLACK_WEBHOOK }}
SLACK_USERNAME: dotBot
SLACK_TITLE: "Attention dotters: Docker image built!"
SLACK_MSG_AUTHOR: " "
MSG_MINIMAL: true
SLACK_FOOTER: ""
SLACK_ICON: https://avatars.githubusercontent.com/u/1005263?s=200&v=4
SLACK_MESSAGE: "<!channel> This automated script is happy to announce that a new docker image has been built for *${{ needs.build-push-image.outputs.version }}* with tags: [${{ needs.build-push-image.outputs.tags }}] :docker:"