-
Notifications
You must be signed in to change notification settings - Fork 55
77 lines (67 loc) · 2.38 KB
/
Copy pathdeploy-docker-image.yml
File metadata and controls
77 lines (67 loc) · 2.38 KB
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
name: "Deploy docker image"
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Which tag to build'
required: true
env:
REGISTRY: ghcr.io
IMAGE_NAME: yuuzi261/tweetcord
IMAGE_DESCRIPTION: A Discord bot for Twitter notifications, using tweety-ns package.
LICENSES: MIT
PLATFORMS: linux/amd64,linux/arm64
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }}
type=raw,value=${{ github.event.inputs.tag }},enable=${{ github.event_name == 'workflow_dispatch' }}
type=raw,value=latest,enable={{is_default_branch}}
labels: |
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.licenses=${{ env.LICENSES }}
annotations: |
org.opencontainers.image.description=${{ env.IMAGE_DESCRIPTION }}
org.opencontainers.image.source=https://github.com/${{ github.repository }}
org.opencontainers.image.licenses=${{ env.LICENSES }}
env:
DOCKER_METADATA_ANNOTATIONS_LEVELS: manifest,index
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: ${{ env.PLATFORMS }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.PLATFORMS }}
- name: Build and push Docker image
uses: docker/build-push-action@v6.18.0
with:
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
provenance: false
sbom: false
annotations: ${{ steps.meta.outputs.annotations }}