forked from cloudtty/cloudtty
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (73 loc) · 2.65 KB
/
build-image-release.yaml
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
name: Build & Release Image
env:
# ghcr.io/cloudtty/cloudtty/cloudshell:latest => ghcr.io/cloudtty/cloudshell:latest
# IMAGE_REPO: ${{ github.repository }}
IMAGE_REPO: cloudtty
REGISTER: ghcr.io
IMAGE_ROOT_PATH: docker
BUILD_PLATFORM: linux/amd64,linux/arm64
REGISTER_USER: ${{ github.actor }}
REGISTER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
on:
workflow_dispatch:
push:
branches:
- main
tags:
- v*
jobs:
docker-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Get the version
id: get_version
run: |
VERSION=${GITHUB_REF#refs/tags/}
if [[ ${GITHUB_REF} == "refs/heads/main" ]]; then
VERSION=latest
fi
echo ::set-output name=VERSION::${VERSION}
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Login registry
run: |
echo "${{ env.REGISTER_PASSWORD }}" | docker login ${{ env.REGISTER }} -u ${{ env.REGISTER_USER }} --password-stdin
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: image=moby/buildkit:master
- name: Build & Pushing operator image
uses: docker/[email protected]
with:
context: .
file: ${{ env.IMAGE_ROOT_PATH }}/operator/Dockerfile
labels: |-
org.opencontainers.image.source=https://github.com/${{ env.IMAGE_REPO }}
org.opencontainers.image.revision=${{ github.sha }}
platforms: ${{ env.BUILD_PLATFORM }}
build-args: |
VERSION=${{ steps.get_version.outputs.VERSION }}
tags: ${{ env.REGISTER }}/${{ env.IMAGE_REPO }}/cloudshell-operator:${{ steps.get_version.outputs.VERSION }}
push: true
provenance: false
github-token: ${{ env.REGISTER_PASSWORD }}
- name: Build & Pushing cloudshell image
uses: docker/[email protected]
with:
context: .
file: ${{ env.IMAGE_ROOT_PATH }}/cloudshell/Dockerfile
labels: |-
org.opencontainers.image.source=https://github.com/${{ env.IMAGE_REPO }}
org.opencontainers.image.revision=${{ github.sha }}
platforms: ${{ env.BUILD_PLATFORM }}
build-args: |
VERSION=${{ steps.get_version.outputs.VERSION }}
tags: ${{ env.REGISTER }}/${{ env.IMAGE_REPO }}/cloudshell:${{ steps.get_version.outputs.VERSION }}
push: true
provenance: false
github-token: ${{ env.REGISTER_PASSWORD }}