-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgithub-build-workflow-multi-arch.yaml
More file actions
85 lines (75 loc) · 2.92 KB
/
Copy pathgithub-build-workflow-multi-arch.yaml
File metadata and controls
85 lines (75 loc) · 2.92 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Build, Package, Release
description: Build and release a Docker image for multi-architecture (AMD64/ARM64) with semantic release.
on:
release:
types:
- created
push:
branches:
- main
env:
VERSION: 0.0.1
jobs:
build-image:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Check out code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
fetch-depth: 0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 20
- name: Semantic Release
uses: cycjimmy/semantic-release-action@b12c8f6015dc215fe37bc154d4ad456dd3833c90 # v6.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: get semversion
run: |
VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Get last commit hash
id: lastHash
run: |
LAST_HASH=$(git rev-parse --short HEAD)
echo "LAST_HASH=$LAST_HASH" >> $GITHUB_ENV
- id: containerRegistryLogin
name: Login to Container Registry
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4.4.0
with:
registry: ${{ vars.MO_REGISTRY_AUTH_URL }}
username: ${{ secrets.MO_REGISTRY_USER }}
password: ${{ secrets.MO_REGISTRY_PAT }}
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4.2.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
- name: Build and push multi-arch image
id: buildAndPushImage
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: ${{ vars.MO_DOCKERCONTEXT }}
file: ${{ vars.MO_DOCKERFILE }}
platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ vars.MO_REGISTRY_URL }}/${{ vars.MO_IMAGE_NAME }}:${{ env.VERSION }}
${{ vars.MO_REGISTRY_URL }}/${{ vars.MO_IMAGE_NAME }}:latest
${{ vars.MO_REGISTRY_URL }}/${{ vars.MO_IMAGE_NAME }}:${{ env.LAST_HASH }}
build-args: |
VERSION=${{ env.VERSION }}
- id: releaseWithMogenius
name: Release with mogenius
uses: mogenius/mogenius-release-action@8be39c76c0206062eb9f26d8fb84b88a5f2dc61b # v1
with:
dev: true
image: ${{ vars.MO_REGISTRY_URL }}/${{ vars.MO_IMAGE_NAME }}:${{ env.VERSION }}
kind: ${{ vars.MO_KIND }}
namespace: ${{ vars.MO_NAMESPACE_NAME }}
resourceName: ${{ vars.MO_RESOURCE_NAME }}
containerName: ${{ vars.MO_CONTAINER_NAME }}
keyKind: ${{ vars.MO_API_KIND }}
token: ${{ secrets.MO_API_TOKEN }}