forked from epfl-lasa/modulo
-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (93 loc) · 3.16 KB
/
build-release.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build and release
on:
push:
branches:
- main
jobs:
check-version:
name: Check if the version has been updated
outputs:
has_changed: ${{ steps.check.outputs.has_changed }}
version: ${{ steps.check.outputs.version }}
runs-on: ubuntu-latest
steps:
- uses: aica-technology/.github/.github/actions/check-version-toml@v1.0.2
id: check
with:
package_path: .
metadata:
name: Get metadata
needs: check-version
runs-on: ubuntu-latest
outputs:
image_name: ${{ steps.ensure-image.outputs.image_name }}
image_tags: ${{ steps.tags.outputs.image_tags }}
create_tag: ${{ steps.tags.outputs.create_tag }}
git_tag: ${{ steps.tags.outputs.git_tag }}
steps:
- uses: aica-technology/.github/.github/actions/ghcr-ensure-prefix@v0.6.0
id: ensure-image
with:
image_name: aica-technology/modulo
- run: |
CREATE_TAG=false
GIT_TAG=""
if [ ${{ needs.check-version.outputs.has_changed }} = 'true' ]; then
CREATE_TAG=true
GIT_TAG="v${{ needs.check-version.outputs.version }}"
if [[ "${GIT_TAG}" == *"-"* ]]; then
IMAGE_TAGS="${GIT_TAG}",rolling
else
IMAGE_TAGS=latest,"${GIT_TAG}",rolling
fi
else
IMAGE_TAGS=rolling
fi
echo "Image tags: ${IMAGE_TAGS}"
echo "Create tag: ${CREATE_TAG}"
echo "Git tag: ${GIT_TAG}"
echo "image_tags=${IMAGE_TAGS}" >> $GITHUB_OUTPUT
echo "create_tag=${CREATE_TAG}" >> $GITHUB_OUTPUT
echo "git_tag=${GIT_TAG}" >> $GITHUB_OUTPUT
id: tags
shell: bash
build:
needs: metadata
strategy:
matrix:
arch: [amd64, arm64]
include:
- image: ubuntu-latest
- image: buildjet-8vcpu-ubuntu-2204-arm
arch: arm64
runs-on: ${{ matrix.image }}
name: Build and publish (${{ matrix.arch }})
steps:
- uses: actions/checkout@v3
- uses: aica-technology/.github/.github/actions/list-add-suffixes@v0.6.0
id: merge-tags
with:
list: ${{ needs.metadata.outputs.image_tags }}
suffixes: ${{ matrix.arch }}
glue_separator: "-"
- uses: aica-technology/.github/.github/actions/ghcr-build@v0.6.1
with:
dockerfile_path: aica-package.toml
image_name: ${{ needs.metadata.outputs.image_name }}
image_tags: ${{ steps.merge-tags.outputs.list }}
token: ${{ secrets.GITHUB_TOKEN }}
multi-arch:
runs-on: ubuntu-latest
name: Merge into a multi-arch image
needs: [ metadata, build ]
steps:
- uses: aica-technology/.github/.github/actions/ghcr-manifest-merge@v0.6.1
with:
image_name: ${{ needs.metadata.outputs.image_name }}
image_tags: ${{ needs.metadata.outputs.image_tags }}
archs: amd64,arm64
token: ${{ secrets.GITHUB_TOKEN }}
- if: needs.metadata.outputs.create_tag == 'true'
uses: aica-technology/.github/.github/actions/git-tag@v0.8.1
with:
tag: ${{ needs.metadata.outputs.git_tag }}