-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.45 KB
/
docker-push.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
name: Docker
on:
workflow_call:
inputs:
RELEASE_VERSION:
description: 'image version'
required: true
type: string
env:
CONTAINER_REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
push:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/download-artifact@v3
with:
name: build
path: ./build
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: setup docker buildx
uses: docker/setup-buildx-action@v2
- name: Login
uses: docker/login-action@v2
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set release version
run: echo "RELEASE_VERSION=$(echo ${{ inputs.RELEASE_VERSION }} | sed 's/+/-/g')" >> $GITHUB_ENV
- name: Build and push
id: docker_build
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: |
${{ env.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ env.RELEASE_VERSION }}
${{ env.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: |
org.opencontainers.image.source=https://github.com/${{ env.IMAGE_NAME }}
org.opencontainers.image.version=${{ env.RELEASE_VERSION }}