generated from RENCI/react-starter
-
Notifications
You must be signed in to change notification settings - Fork 0
79 lines (67 loc) · 2.96 KB
/
image-push.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
# Copyright (c) 2024, The University of North Carolina at Chapel Hill All rights reserved.
# SPDX-FileCopyrightText: 2022 Renaissance Computing Institute. All rights reserved.
#
# SPDX-License-Identifier: BSD 3-Clause
name: Build and push the APSViz UI/V3 Docker image tagged with "latest" and version number
# trigger event is publishing a release in the repo
on:
release:
types: [published]
# working parameters that are specific to this script
env:
REGISTRY: containers.renci.org/eds/apsviz-ui-v3
# job definition
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
# job steps
steps:
# checkout the codebase
- name: Checkout
uses: actions/checkout@v4
# connect to the renci image registry
- name: Login to containers.renci.org
uses: docker/login-action@v2
with:
registry: containers.renci.org
username: ${{ secrets.USER }}
password: ${{ secrets.PW }}
# get the tag for the image
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
# build and push the image. The docker v3 action automatically handles the git checkout.
- name: Build/Push the image to the registry
uses: docker/build-push-action@v3
with:
push: true
build-args: |
APP_VERSION=${{ steps.get_version.outputs.VERSION }}
APP_UI_MAPBOX_TOKEN=${{ secrets.UI_MAPBOX_TOKEN }}
APP_GS_DATA_AWS_URL=${{ secrets.GS_DATA_AWS_URL }}
APP_UI_DATA_AWS_URL=${{ secrets.UI_DATA_AWS_URL }}
APP_UI_DATA_AWS_TOKEN=${{ secrets.UI_DATA_AWS_TOKEN }}
APP_UI_HURRICANE_ICON_AWS_URL=${{ secrets.UI_HURRICANE_ICON_AWS_URL }}
APP_GS_DATA_PROD_URL=${{ secrets.GS_DATA_PROD_URL }}
APP_UI_DATA_PROD_URL=${{ secrets.UI_DATA_PROD_URL }}
APP_UI_DATA_PROD_TOKEN=${{ secrets.UI_DATA_PROD_TOKEN }}
APP_UI_HURRICANE_ICON_PROD_URL=${{ secrets.UI_HURRICANE_ICON_PROD_URL }}
APP_GS_DATA_DEV_URL=${{ secrets.GS_DATA_DEV_URL }}
APP_UI_DATA_DEV_URL=${{ secrets.UI_DATA_DEV_URL }}
APP_UI_DATA_DEV_TOKEN=${{ secrets.UI_DATA_DEV_TOKEN }}
APP_UI_HURRICANE_ICON_DEV_URL=${{ secrets.UI_HURRICANE_ICON_DEV_URL }}
tags: |
${{ env.REGISTRY }}:latest
${{ env.REGISTRY }}:${{ steps.get_version.outputs.VERSION }}
# push the image to AWS/ECR
- name: Push the built image to the AWS/ECR registry
id: ecr
uses: jwalton/gh-ecr-push@v1
with:
access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
region: us-east-2
local-image: ${{ env.REGISTRY }}:${{ steps.get_version.outputs.VERSION }}
image: apsviz-ui-v3:latest, apsviz-ui-v3:${{ steps.get_version.outputs.VERSION }}