-
-
Notifications
You must be signed in to change notification settings - Fork 2
55 lines (47 loc) · 1.61 KB
/
front_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
name: Push frontend image
on:
workflow_dispatch:
inputs:
environment:
description: "Environment"
required: true
default: "staging"
jobs:
push_image:
runs-on: ubuntu-latest
environment: ${{ github.event.inputs.environment }}
env:
NEXT_PUBLIC_STAGE: staging
NEXT_PUBLIC_BACKEND_URL: ${{ vars.NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_URL: ${{ vars.NEXT_PUBLIC_URL }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: "18.13"
- name: Get version
id: package
run: echo "::set-output name=version::$(node -p "require('./front/package.json').version")"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
file: ./front/Dockerfile.front
target: final
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/composite-front:${{ steps.package.outputs.version }},
${{ secrets.DOCKERHUB_USERNAME }}/composite-front:latest
build-args: |
NPM_TOKEN=${{ secrets.NPM_TOKEN }}
NEXT_PUBLIC_STAGE=staging
NEXT_PUBLIC_BACKEND_URL=${{ vars.NEXT_PUBLIC_BACKEND_URL }}
NEXT_PUBLIC_URL=${{ vars.NEXT_PUBLIC_URL}}
INTERNAL_BACKEND_URL=${{ vars.INTERNAL_BACKEND_URL }}