-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2.17 KB
/
docker.yml
File metadata and controls
68 lines (58 loc) · 2.17 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
name: "Docker"
# Only trigger if we changed the files used in the image
on:
release:
types:
- published
jobs:
docker-release:
name: "Release Docker Image"
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Prepare Tags
id: prepare
run: |
TAG=${GITHUB_REF#refs/tags/}
RSHELL_VERSION=${GITHUB_REF#refs/tags/v}
MAJOR_MINOR=${TAG%.*}
MAJOR_ONLY=${TAG%.*.*}
SHORT_COMMIT=${GITHUB_SHA::8}
echo ::set-output name=tag_name::${TAG}
echo ::set-output name=rshell_version::${RSHELL_VERSION}
echo ::set-output name=major_tag::${MAJOR_ONLY}
echo ::set-output name=major_minor_tag::${MAJOR_MINOR}
echo ::set-output name=short_commit::${SHORT_COMMIT}
echo ::set-output name=full_tag_name::${TAG}
echo ::set-output name=full_major_tag::${MAJOR_ONLY}
echo ::set-output name=full_major_minor_tag::${MAJOR_MINOR}
echo ::set-output name=latest_tag::latest
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build and publish
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
build-args: |
RSHELL_VERSION=${{ steps.prepare.outputs.rshell_version }}
tags: |
ghcr.io/${{ github.repository }}:${{ steps.prepare.outputs.full_tag_name }}
ghcr.io/${{ github.repository }}:${{ steps.prepare.outputs.full_major_tag }}
ghcr.io/${{ github.repository }}:${{ steps.prepare.outputs.full_major_minor_tag }}
ghcr.io/${{ github.repository }}:${{ steps.prepare.outputs.latest_tag }}
cache-from: type=gha
cache-to: type=gha,mode=max