forked from tomkerkhove/promitor
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.64 KB
/
templates-build-push-image.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
name: Build and Push (Linux)
on:
workflow_dispatch:
inputs:
image_name:
required: true
type: string
version:
required: true
type: string
project_name:
required: true
type: string
jobs:
linux:
name: Build & Push (Linux)
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: "Determine preview artifact version"
run: |
echo "artifact_full_version=${{ inputs.version }}-${{ github.sha }}" >> $GITHUB_ENV
- name: "Determine full container image uri (commit)"
run: |
echo "image_commit_uri=${{ inputs.image_name }}:$artifact_full_version" >> $GITHUB_ENV
- name: "Determine full container image uri (latest)"
run: |
echo "image_latest_uri=${{ inputs.image_name }}:${{ inputs.version }}" >> $GITHUB_ENV
- name: Determine container image metadata
uses: docker/[email protected]
with:
images: ${{ inputs.image_name }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: hkfgo
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push preview image
uses: docker/[email protected]
with:
build-args: VERSION="${{ env.artifact_full_version }}"
context: ./src/
file: ./src/${{ inputs.project_name }}/Dockerfile.linux
tags: ghcr.io/hkfgo/${{ env.image_commit_uri }},ghcr.io/hkfgo/${{ env.image_latest_uri }}
push: true