forked from stoplightio/prism
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.96 KB
/
dockerhub-publish.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
name: Build & Publish Docker image
on:
push:
branches:
- master
release:
types: [published]
env:
IS_RELEASE: ${{github.event_name == 'release'}}
DOCKER_BUILD_ARGS: |
BUILD_TYPE=production
YARN_NETWORK_TIMEOUT=480000
DOCKER_BUILD_PLATFORMS: |
linux/amd64
linux/arm64
jobs:
docker-publish:
runs-on: ubuntu-latest
timeout-minutes: 120
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Compute release version tags
if: env.IS_RELEASE == 'true'
run: |
echo "TAG_PRIMARY_VERSION=$(release='${{github.event.release.tag_name}}' && echo ${release:1:1})" >> $GITHUB_ENV
echo "TAG_FULL_VERSION=$(release='${{github.event.release.tag_name}}' && echo ${release:1})" >> $GITHUB_ENV
-
name: Build and Push release tags
if: env.IS_RELEASE == 'true'
uses: docker/build-push-action@v4
with:
push: true
tags: |
${{format('{0}/prism:{1}', secrets.DOCKERHUB_USERNAME, env.TAG_FULL_VERSION)}}
${{format('{0}/prism:{1}', secrets.DOCKERHUB_USERNAME, env.TAG_PRIMARY_VERSION)}}
${{format('{0}/prism:{1}', secrets.DOCKERHUB_USERNAME, 'latest')}}
platforms: ${{env.DOCKER_BUILD_PLATFORMS}}
build-args: ${{env.DOCKER_BUILD_ARGS}}
-
name: Build and Push master Tag
if: env.IS_RELEASE != 'true'
uses: docker/build-push-action@v4
with:
push: true
tags: |
${{format('{0}/prism:master', secrets.DOCKERHUB_USERNAME)}}
platforms: ${{env.DOCKER_BUILD_PLATFORMS}}
build-args: ${{env.DOCKER_BUILD_ARGS}}