-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.48 KB
/
build_and_upload_docker_image_on_push.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
name: Build & Upload Fairspace-Jupyter Docker image
env:
DOCKER_REGISTRY: ghcr.io
on:
push:
branches:
- dev
- release
- devops/FAIRSPC-57_github_actions
jobs:
build-and-upload-jupyterhub:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Get version tag for artifact
run: |
BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}
echo "Building images from the branch: $BRANCH"
VER=$(cat .projects/jupyterhub-hub/VERSION)
echo "Building images of version: $VER"
if [ $BRANCH != "release" ]
then
VER=$VER-SNAPSHOT
fi
echo "fairspace_version=$VER" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_REGISTRY }}/fairspace/jupyterhub-hub
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: ./projects/jupyterhub-hub/
push: true
tags: ${{ env.DOCKER_REGISTRY }}/${{ github.repository }}/jupyterhub-hub:${{ env.VERSION }}
labels: ${{ steps.meta.outputs.labels }}