-
Notifications
You must be signed in to change notification settings - Fork 31
72 lines (64 loc) · 2.23 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
name: Core - Release Docker
on:
release:
types: [published]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}_core
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: release/
version: "tags/${{ github.event.release.tag_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: ${{ !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: .
platforms: linux/amd64,linux/arm64
file: ./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 }}