-
-
Notifications
You must be signed in to change notification settings - Fork 644
72 lines (63 loc) · 2.35 KB
/
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
64
65
66
67
68
69
70
71
72
name: publish
on:
workflow_run:
workflows: ["build"]
types:
- completed
jobs:
publish:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Dump GitHub context
run: echo "$GITHUB_CONTEXT"
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.workflow_run.head_sha }}
- 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.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: build and push docker image (pull_request)
if: ${{ github.event.workflow_run.event == 'pull_request' }}
uses: docker/build-push-action@v3
with:
push: true
context: .
build-args: COMMITHASH=${{ github.event.workflow_run.head_sha }}
platforms: linux/amd64,linux/arm64/v8
tags: getfider/fider:PR_${{ github.event.workflow_run.pull_requests[0].number }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: build and push docker image (push branch)
if: ${{ github.event.workflow_run.event == 'push' }}
uses: docker/build-push-action@v3
with:
push: true
context: .
build-args: COMMITHASH=${{ github.event.workflow_run.head_sha }}
platforms: linux/amd64,linux/arm64/v8
tags: |
getfider/fider:SHA_${{ github.event.workflow_run.head_sha }}
getfider/fider:${{ github.event.workflow_run.head_branch == 'main' && 'main' || 'stable' }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: build and push docker image (push tag)
if: ${{ github.event.workflow_run.event == 'release' }}
uses: docker/build-push-action@v3
with:
push: true
context: .
build-args: COMMITHASH=${{ github.event.workflow_run.head_sha }}
platforms: linux/amd64,linux/arm64/v8
tags: getfider/fider:${{ github.event.workflow_run.display_title }}
cache-from: type=gha
cache-to: type=gha,mode=max