-
Notifications
You must be signed in to change notification settings - Fork 14
49 lines (47 loc) · 1.64 KB
/
frontend-release.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
name: Publish frontend docker image on DockerHub
on:
push:
tags:
- frontend/*
jobs:
publish-docker-image:
runs-on: ubuntu-latest
environment: release
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
flavor: latest=false
images: concordium/ccdscan-frontend
tags: type=match,pattern=frontend/(.*),group=1
- name: Ensure tag matches version in package.json
run: |
PACKAGE_VERSION=$(jq -r .version frontend/package.json)
EXPECTED_TAG="concordium/ccdscan-frontend:$PACKAGE_VERSION"
EXTRACTED_TAG=${{ steps.meta.outputs.tag }}
if [ "$EXPECTED_TAG" = "$EXTRACTED_TAG" ]; then
printf "Extracted tag matches the version in package.json ($EXTRACTED_TAG).\n"
exit 0
else
printf "ERROR: Extracted tag does not match the expected derived from the version in package.json. \nExtracted: '$EXTRACTED_TAG'\nExpected: '$EXPECTED_TAG'\n"
exit 1
fi
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: ./frontend
file: ./frontend/Dockerfile
push: false
platforms: linux/amd64
tags: ${{ steps.meta.outputs.tag }}
labels: ${{ steps.meta.outputs.labels }}