This repository was archived by the owner on Sep 25, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 352
42 lines (41 loc) · 1.86 KB
/
upload-images.yaml
File metadata and controls
42 lines (41 loc) · 1.86 KB
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
name: Upload Images
on:
workflow_dispatch:
push:
branches:
- production
jobs:
build:
name: Build and Upload Images
runs-on: ubuntu-latest
steps:
- name: Checkout Source
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
- name: Login to Docker Hub
run: |
echo ${{ secrets.DOCKER_PAT }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
# Due to a quirk of Actions, the .env file overwrites the env: values you
# set in the YAML. We create this empty file so that the build does not
# fail, but pass the values in via env:
- name: Create Dummy .env
run: touch .env
- name: Build Images
env:
NEXT_PUBLIC_SERVER_URL: ${{ secrets.CHAPTER_SERVER_URL }}
NEXT_PUBLIC_AUTH0_DOMAIN: ${{ secrets.AUTH0_DOMAIN }}
NEXT_PUBLIC_AUTH0_AUDIENCE: ${{ secrets.AUTH0_AUDIENCE }}
NEXT_PUBLIC_AUTH0_CLIENT_ID: ${{ secrets.AUTH0_CLIENT_ID }}
NEXT_PUBLIC_DEPLOYMENT_ENVIRONMENT: ${{ secrets.DEPLOYMENT_ENVIRONMENT }}
NEXT_PUBLIC_CLIENT_URL: ${{ secrets.CHAPTER_CLIENT_URL }}
NODE_ENV: production
run: |
docker compose -f docker-compose.yml build
tagname=$(git rev-parse --short HEAD)-$(date +%Y%m%d)-$(date +%H%M)
docker tag chapter-server ${{ secrets.DOCKER_NAMESPACE }}/chapter-server:$tagname
docker tag chapter-server ${{ secrets.DOCKER_NAMESPACE }}/chapter-server:latest
docker tag chapter-client ${{ secrets.DOCKER_NAMESPACE }}/chapter-client:$tagname
docker tag chapter-client ${{ secrets.DOCKER_NAMESPACE }}/chapter-client:latest
- name: Upload Images
run: |
docker push --all-tags ${{ secrets.DOCKER_NAMESPACE }}/chapter-server
docker push --all-tags ${{ secrets.DOCKER_NAMESPACE }}/chapter-client