-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (60 loc) · 1.98 KB
/
frontend_ci.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
name: Frontend CI
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
# When this action will be executed
on:
# Automatically trigger it when detected changes in repo
push:
branches:
- main
- prod
paths:
- "frontend/**"
- ".github/workflows/frontend_ci.yml"
pull_request:
branches:
- main
- prod
paths:
- "frontend/**"
- ".github/workflows/frontend_ci.yml"
# Allow manual trigger
workflow_dispatch:
permissions:
contents: read
issues: read
checks: write
pull-requests: write
env:
REGISTRY_ADDRESS: containers.deltares.nl
HARBOR_PROJECT: fair-data
TAG: ${{ github.ref == 'refs/heads/prod' && 'prod' || 'dev' }}
TARGET: ${{ github.ref == 'refs/heads/prod' && 'run-prod' || 'run-dev' }}
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository to the runner
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY_ADDRESS }}
username: ${{ secrets.HARBOR_USER }}
password: ${{ secrets.HARBOR_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: frontend
cache-from: type=gha
cache-to: type=gha,mode=max
target: ${{ env.TARGET }}
push: ${{ github.event_name != 'pull_request'}} # Don't push on pull requests, only on push
tags: |
${{ env.REGISTRY_ADDRESS }}/${{ env.HARBOR_PROJECT }}/frontend:${{ github.sha }}
${{ env.REGISTRY_ADDRESS }}/${{ env.HARBOR_PROJECT }}/frontend:${{ env.TAG }}