-
Notifications
You must be signed in to change notification settings - Fork 97
66 lines (63 loc) · 2.16 KB
/
Copy pathbuild_and_push_dev.yaml
File metadata and controls
66 lines (63 loc) · 2.16 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
name: Build image, main branch push quay.io
on:
push:
branches: [ main ]
env:
IMAGE_NAME: lightspeed-stack
IMAGE_NAMESPACE: lightspeed-core
IMAGE_REGISTRY: quay.io
LATEST_TAG: dev-latest
CONTAINER_FILE: deploy/lightspeed-stack/Containerfile
jobs:
build-and-push-dev:
runs-on: ubuntu-latest
permissions:
contents: read
# Required for image pushing to a registry
packages: write
steps:
- name: Install buildah
run: |
sudo apt update
# qemu is required for arm64 builds
sudo apt install -y buildah qemu-user-static
- name: Checkout code
uses: actions/checkout@v7
with:
# Fetch submodules (required for lightspeed-providers)
submodules: 'recursive'
- name: Create dev image tag
run: |
echo "DEV_TAG=dev-$(date +%Y%m%d)-$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "SHORT_COMMIT=$(git rev-parse --short=7 HEAD)" >> $GITHUB_ENV
echo "dev image tag: ${{ env.DEV_TAG }}"
- name: Build image with Buildah
id: build_image
uses: redhat-actions/buildah-build@v2
with:
image: ${{ env.IMAGE_NAME }}
tags: |
${{ env.DEV_TAG }}
${{ env.SHORT_COMMIT }}
${{ env.LATEST_TAG }}
containerfiles: |
${{ env.CONTAINER_FILE }}
archs: amd64, arm64
oci: true
- name: Check images
run: |
buildah images | grep '${{ env.IMAGE_NAME }}'
echo '${{ steps.build_image.outputs.image }}'
echo '${{ steps.build_image.outputs.tags }}'
- name: Check manifest
run: |
set -x
buildah manifest inspect ${{ steps.build_image.outputs.image }}:${{ env.LATEST_TAG }}
- name: Push image to Quay.io
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAMESPACE }}
username: ${{ secrets.QUAY_REGISTRY_USERNAME }}
password: ${{ secrets.QUAY_REGISTRY_PASSWORD }}