-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgithub-build-workflow-amd64.yaml
More file actions
85 lines (75 loc) · 2.52 KB
/
Copy pathgithub-build-workflow-amd64.yaml
File metadata and controls
85 lines (75 loc) · 2.52 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 AMD64 architecture 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@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
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@v3
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@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push amd64 image
id: buildAndPushImage
uses: docker/build-push-action@v5
with:
context: ${{ vars.MO_DOCKERCONTEXT }}
file: ${{ vars.MO_DOCKERFILE }}
platforms: linux/amd64
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@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 }}