This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
167 lines (159 loc) · 5.53 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
# This is a basic workflow that is manually triggered
name: Publish Docker Image
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
name:
# Friendly description to be shown in the UI instead of 'name'
description: 'Publish to DockerHub'
# Default value if no value is explicitly provided
default: 'latest'
# Input has to be provided for the workflow to run
required: true
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ created ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
webportal:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
if: ${{ github.event_name != 'pull_request' }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set output
id: vars
run: echo ::set-output name=version::${GITHUB_REF#refs/*/}
- name: Build in pull request
id: docker_build_pr
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'pull_request' }}
with:
context: .
file: ./webportal/deploy/Dockerfile
push: false
build-args: |
VERSION=${{ github.event.pull_request.head.ref }}
TARGET=${{ github.event.pull_request.head.repo.git_url }}
tags: openpai/pai-marketplace-webportal:int
- name: Build and push after merge PR
id: docker_build_push
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'push' }}
with:
context: .
file: ./webportal/deploy/Dockerfile
push: true
build-args: VERSION=${{ steps.vars.outputs.version }}
tags: openpai/pai-marketplace-webportal:latest
- name: Build and push on release
id: docker_build_release
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'release' }}
with:
context: .
file: ./webportal/deploy/Dockerfile
push: true
build-args: VERSION=${{ steps.vars.outputs.version }}
tags: openpai/pai-marketplace-webportal:${{ steps.vars.outputs.version }}
- name: Build and push manual
id: docker_build_manual
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
context: .
file: ./webportal/deploy/Dockerfile
push: true
build-args: VERSION=${{ steps.vars.outputs.version }}
tags: openpai/pai-marketplace-webportal:${{ github.event.inputs.name }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
restserver:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
if: ${{ github.event_name != 'pull_request' }}
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Set output
id: vars
run: echo ::set-output name=version::${GITHUB_REF#refs/*/}
- name: Build in pull request
id: docker_build_pr
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'pull_request' }}
with:
context: .
file: ./rest_server/deploy/Dockerfile
push: false
build-args: |
VERSION=${{ github.event.pull_request.head.ref }}
TARGET=${{ github.event.pull_request.head.repo.git_url }}
tags: openpai/pai-marketplace-restserver:int
- name: Build and push after merge PR
id: docker_build_push
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'push' }}
with:
context: .
file: ./rest_server/deploy/Dockerfile
push: true
build-args: VERSION=${{ steps.vars.outputs.version }}
tags: openpai/pai-marketplace-restserver:latest
- name: Build and push on release
id: docker_build_release
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'release' }}
with:
context: .
file: ./rest_server/deploy/Dockerfile
push: true
build-args: VERSION=${{ steps.vars.outputs.version }}
tags: openpai/pai-marketplace-restserver:${{ steps.vars.outputs.version }}
- name: Build and push manual
id: docker_build_manual
uses: docker/build-push-action@v2
if: ${{ github.event_name == 'workflow_dispatch' }}
with:
context: .
file: ./rest_server/deploy/Dockerfile
push: true
build-args: VERSION=${{ steps.vars.outputs.version }}
tags: openpai/pai-marketplace-restserver:${{ github.event.inputs.name }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}