-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (53 loc) · 2.01 KB
/
Copy pathimage-kairos-ubuntu.yml
File metadata and controls
56 lines (53 loc) · 2.01 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
---
name: Build Kairos-Ubuntu
on: # yamllint disable-line rule:truthy
push:
branches:
- main
paths:
- .github/workflows/image-kairos-ubuntu.yml
- images/kairos-ubuntu/**
tags:
- kairos-ubuntu-*
pull_request:
branches:
- main
paths:
- .github/workflows/image-kairos-ubuntu.yml
- images/kairos-ubuntu/**
jobs:
build-container:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout Repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Login to GitHub Container Registry
uses: docker/login-action@4907a6ddec9925e35a0a9e82d7399ccc52663121 # v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Note: this must start with a number for the build to work correctly!
- name: Compute Version Tag
env:
BRANCH: ${{ github.ref_type == 'tag' && github.ref_name || github.event_name != 'pull_request' && format('{0}.{1}.{2}', github.run_id, github.run_number, github.run_attempt) || format('{0}-pr', github.event.number) }}
id: version_tag
run: echo "tag=$BRANCH" | sed -e 's/kairos-ubuntu-//' >> "$GITHUB_OUTPUT"
- name: Generate Metadata
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
id: metadata
with:
images: ghcr.io/${{ github.repository_owner }}/kairos-ubuntu
- name: Build Image
uses: docker/build-push-action@bcafcacb16a39f128d818304e6c9c0c18556b85f # v7.1.0
with:
build-args: |
VERSION=${{ steps.version_tag.outputs.tag }}
context: images/kairos-ubuntu
file: images/kairos-ubuntu/Containerfile
labels: ${{ steps.metadata.outputs.labels }}
push: ${{ github.ref_type == 'tag' }}
tags: ghcr.io/${{ github.repository_owner }}/kairos-ubuntu:${{ steps.version_tag.outputs.tag }}