-
-
Notifications
You must be signed in to change notification settings - Fork 4
70 lines (63 loc) · 2.02 KB
/
build.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
name: Build and Push Docker Images
# The master branch will have the :latest tag will will be kept one to one with the latest versioned release.
on:
workflow_dispatch:
inputs:
branch:
description: 'Branch to build (optional)'
required: false
schedule:
- cron: "0 0 * * 1"
push:
branches:
- 'Master'
- 'v1.*'
paths:
- Dockerfile
jobs:
build_and_push:
name: Build and Push Docker Image
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
branch:
- Master
- v1.11.5
- v1.11.6
- v1.11.7
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch || matrix.branch }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Prepare tags and version
shell: bash
run: |
if [[ "${{ matrix.branch }}" == "Master" ]]; then
# Dynamically fetch the latest version tag for the Master branch
LATEST_VERSION=$(git tag | grep '^v' | sort -V | tail -n1)
echo "VERSION_TAG=$LATEST_VERSION" >> $GITHUB_ENV
echo "TAGS=ghcr.io/blueprintframework/blueprint:latest" >> $GITHUB_ENV
else
# Use the branch name as the version tag
echo "VERSION_TAG=${{ matrix.branch }}" >> $GITHUB_ENV
echo "TAGS=ghcr.io/blueprintframework/blueprint:${{ matrix.branch }}" >> $GITHUB_ENV
fi
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
push: true
tags: ${{ env.TAGS }}
build-args: VERSION_TAG=${{ env.VERSION_TAG }}