-
Notifications
You must be signed in to change notification settings - Fork 6
55 lines (48 loc) · 1.75 KB
/
release.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
---
name: Release
on:
release:
types: released
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-22.04
name: Build Container Image
steps:
- uses: actions/checkout@v4
name: Checkout code
- name: Get current date and time
run: echo "now=$(date --rfc-3339=seconds | tr ' ' 'T')" >> $GITHUB_ENV
- name: Get Container tags
if: startsWith(github.ref, 'refs/tags/')
run: |
VERSION_MAJOR=$(echo ${{ github.ref_name }} | tr -d 'v' | cut -d'.' -f1)
VERSION_MINOR=$(echo ${{ github.ref_name }} | tr -d 'v' | cut -d'.' -f2)
echo "CONTAINER_TAGS=latest v${VERSION_MAJOR} v${VERSION_MAJOR}.${VERSION_MINOR} ${{ github.ref_name }}" >> $GITHUB_ENV
- name: Get Container tags
if: startsWith(github.ref, 'refs/heads/')
run: echo "CONTAINER_TAGS=main" >> $GITHUB_ENV
- name: Build Container Image
id: build-image
uses: redhat-actions/buildah-build@v2
with:
image: mq_exporter
tags: ${{ env.CONTAINER_TAGS }}
labels: |
org.opencontainers.image.created=${{ env.now }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ github.ref_name }}
build-date=${{ env.now }}
version=${{ github.ref_name }}
vcs-ref=${{ github.sha }}
containerfiles: ./Containerfile
- name: Push to quay.io
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build-image.outputs.image }}
tags: ${{ steps.build-image.outputs.tags }}
registry: quay.io/agebhar1
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}