-
Notifications
You must be signed in to change notification settings - Fork 12
92 lines (87 loc) · 2.76 KB
/
cd.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Continous Deployment
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
releaseer:
runs-on: ubuntu-latest
steps:
-
name: Create release
id: release-please
uses: google-github-actions/release-please-action@v3
with:
release-type: python
package-name: scicon
-
name: Print Release Info
if: ${{ steps.release-please.outputs.release_created }}
shell: bash
run: |
echo "Release Version: ${{ steps.release-please.outputs.tag_name }}"
outputs:
release_created: ${{ steps.release-please.outputs.releases_created }}
releases: ${{ steps.release-please.outputs.releases }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
builder:
runs-on: ubuntu-latest
needs: releaseer
if : ${{ needs.releaseer.outputs.release_created }}
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
-
name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 1
-
name: Create Release Metadata
id: metadata
run: |
echo "Creating Release Metadata"
echo "Release Tag: ${{ needs.releaseer.outputs.tag_name }}"
REGISTRY="images.canfar.net/"
echo REGISTRY=${REGISTRY} >> $GITHUB_OUTPUT
IMAGE="canfar/base"
echo IMAGE=${IMAGE} >> $GITHUB_OUTPUT
FLAVOR=${{ matrix.python-version }}
echo FLAVOR=${FLAVOR} >> $GITHUB_OUTPUT
TAG=${{ needs.releaseer.outputs.tag_name }}
echo TAG=${TAG} >> $GITHUB_OUTPUT
echo IMAGE_LATEST=${REGISTRY}${IMAGE}-{FLAVOR}:latest >> $GITHUB_OUTPUT
echo IMAGE_TAGGED=${REGISTRY}${IMAGE}-{FLAVOR}:${TAG} >> $GITHUB_OUTPUT
-
name: Setup Docker Buildx Environment
id: buildx
uses: docker/setup-buildx-action@v1
with:
install: true
-
name: Perform CANFAR Harbor Login
uses: docker/login-action@v1
with:
registry: images.canfar.net
username: ${{ secrets.HARBOR_CANFAR_USERNAME }}
password: ${{ secrets.HARBOR_CANFAR_PASSWORD }}
-
name: Build & Push Production Image
uses: docker/build-push-action@v3
id: build-push-production
with:
context: scicon/images/base
file: scicon/images/base/Dockerfile
platforms: linux/amd64
build-args:
PYTHON_VERSION=${{ matrix.python-version }}
tags: |
${{ steps.metadata.outputs.IMAGE_LATEST }}
${{ steps.metadata.outputs.IMAGE_TAGGED }}
push: true
cache-from: type=gha
cache-to: type=gha,mode=max