-
Notifications
You must be signed in to change notification settings - Fork 55
47 lines (46 loc) · 1.35 KB
/
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
name: Publish Docker image
on:
release:
types: [published]
pull_request:
types: [labeled]
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'release' || (github.event_name == 'pull_request' && github.event.label.name == 'build-release-container') }}
steps:
- name: Setup BuildX
uses: docker/setup-buildx-action@v2
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Get tags
run: git fetch --tags origin
- name: Generate docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: |
joshproject/josh-proxy
tags: |
type=ref,event=tag
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: initcrash
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build docker image
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: |
git=.git
docker=docker
target: run
push: ${{ github.event_name == 'release' && 'true' || 'false' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}