-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (54 loc) · 1.75 KB
/
ci.yaml
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
name: ci
on:
workflow_dispatch:
push:
branches:
- main
- develop
- feature/*
- chore/*
tags:
- v*
paths-ignore:
- ".github/**"
env:
img-registry: ghcr.io/h0n9
img-repository: msg-lake
img-tags: ghcr.io/h0n9/msg-lake:tmp
img-push: "false"
img-platforms: linux/amd64
jobs:
build-push:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ${{ env.img-registry }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: "Set env vars (develop, feature)"
if: ${{ github.ref_name == 'develop' || startsWith(github.ref_name, 'feature') }}
shell: bash
run: |
echo "img-tags=${{ env.img-registry }}/${{ env.img-repository }}:dev-${GITHUB_SHA::6}" >> $GITHUB_ENV
echo "img-push=true" >> $GITHUB_ENV
- name: "Set env vars (tag)"
if: ${{ startsWith(github.ref_name, 'v') }}
shell: bash
run: |
echo "img-tags=${{ env.img-registry }}/${{ env.img-repository }}:${GITHUB_REF_NAME},${{ env.img-registry }}/${{ env.img-repository }}:latest" >> $GITHUB_ENV
echo "img-push=true" >> $GITHUB_ENV
echo "img-platforms=linux/amd64,linux/arm64" >> $GITHUB_ENV
- name: Build Docker image
uses: docker/build-push-action@v5
with:
platforms: ${{ env.img-platforms }}
push: ${{ env.img-push }}
tags: ${{ env.img-tags }}
cache-from: type=gha,scope=msg-lake
cache-to: type=gha,mode=max,scope=msg-lake