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
name: build
on:
workflow_dispatch:
inputs:
version:
description: version
required: true
type: string
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write # create the GitHub release and its tag.
packages: write # push the image to GHCR.
steps:
- name: Checkout repository
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6.1.0
with:
persist-credentials: false
- name: Download Soju
run: |
make soju
env:
SOJU_VERSION: ${{ github.event.inputs.version }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3.12.0
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@c299e40c65443455700f0fdfc63efafe5b349051 # v5.10.0
with:
images: ghcr.io/kejadlen/soju
tags: |
type=semver,pattern={{version}},value=v${{ github.event.inputs.version }}
- name: Log in to the Container registry
uses: docker/login-action@c94ce9fb468520275223c153574b00df6fe4bcc9 # v3.7.0
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8 # v6.19.2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
SOJU_VERSION: ${{ github.event.inputs.version }}
run: |
gh release create "v$SOJU_VERSION" \
--target "$GITHUB_SHA" \
--title "v$SOJU_VERSION" \
--notes "Docker image for [soju v$SOJU_VERSION](https://codeberg.org/emersion/soju/releases/tag/v$SOJU_VERSION), published as ghcr.io/kejadlen/soju:$SOJU_VERSION."