-
Notifications
You must be signed in to change notification settings - Fork 31
87 lines (76 loc) · 2.58 KB
/
core-release-docker.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
name: Core - Release Docker
on:
release:
types: [published]
workflow_dispatch:
inputs:
version:
description: "Release tag to download binaries from, must be an existing release"
required: true
type: string
stable:
description: "Is this a stable release?"
required: true
type: boolean
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}_core
permissions:
contents: read
packages: write
jobs:
core-release-docker:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./core
steps:
- name: checkout repository
uses: actions/checkout@v3
- name: set up QEMU
uses: docker/setup-qemu-action@v2
- name: set up docker buildx
uses: docker/setup-buildx-action@v2
- name: log in to the container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: string_tag
uses: ASzc/change-string-case-action@v5
with:
string: ${{ env.REGISTRY}}/${{ env.IMAGE_NAME }}
- id: release_asset
name: Download release assets
uses: dsaltares/fetch-gh-release-asset@master
with:
regex: true
file: "lodestone_core_.*"
target: core/release/
version: "tags/${{ inputs.version || github.ref_name }}"
token: ${{ secrets.GITHUB_TOKEN }}
# https://stackoverflow.com/questions/73402042/github-action-expressions-split-string
- name: set version string
env:
VERSION: ${{ steps.release_asset.outputs.version }}
id: substring
run: echo "version=${VERSION:1}" >> $GITHUB_OUTPUT
- name: set docker version label
env:
LABEL: ${{ (inputs.stable || !github.event.release.prerelease) && 'latest-stable' || 'latest-beta' }}
id: release_type
run: echo "label=${LABEL}" >> $GITHUB_OUTPUT
- name: build and push
uses: docker/build-push-action@v3
with:
context: ./core
platforms: linux/amd64,linux/arm64
file: ./core/githubactions.Dockerfile
build-args: |
lodestone_version=${{ steps.release_asset.outputs.version }}
push: true
tags: |
${{ steps.string_tag.outputs.lowercase }}:latest
${{ steps.string_tag.outputs.lowercase }}:${{ steps.release_type.outputs.label }}
${{ steps.string_tag.outputs.lowercase }}:${{ steps.substring.outputs.version }}