-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (82 loc) · 2.75 KB
/
docker-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
name: Docker Build and Publish
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
repository_dispatch:
types: [docker-publish]
workflow_dispatch:
inputs:
KITSU_VERSION:
description: "Kitsu Version"
required: true
default: "0.15.50"
LATEST:
description: "Latest"
required: true
default: false
type: boolean
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Set Environment Variable
run: |
# Kitsu version
if [ -n "${{ github.event.client_payload.KITSU_VERSION }}" ]; then
KITSU_VERSION=${{ github.event.client_payload.KITSU_VERSION }}
else
KITSU_VERSION=${{ inputs.KITSU_VERSION }}
fi
echo "KITSU_VERSION=$KITSU_VERSION" >> $GITHUB_ENV
# Latest tag
if [ -z "${{ inputs.LATEST }}" ] || [ "${{ inputs.LATEST }}" == "true" ]; then
LATEST="true"
else
LATEST="false"
fi
echo "LATEST=$LATEST" >> $GITHUB_ENV
- name: Kitsu version and Latest tag
run: |
echo "The KITSU_VERSION is ${{ env.KITSU_VERSION }}"
echo "Latest tag is set to ${{ env.LATEST }}"
- name: Checkout repository
uses: actions/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.PAT }}
- name: Extract Docker metadata
id: meta
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: latest=${{ env.LATEST }}
tags: type=raw,value=${{ env.KITSU_VERSION }}
- name: Meta version
run: echo "The Meta is ${{ steps.meta.outputs.tags }}"
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: KITSU_VERSION=${{ env.KITSU_VERSION }}
cache-from: type=gha
cache-to: type=gha,mode=max