-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (56 loc) · 2.05 KB
/
deploy.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
name: "Deploy to Production Registry"
on:
release:
types: [published]
# GITHUB_REF should be the tag - https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
env:
DEV_REGISTRY: ghcr.io/dtcenter/metexpress/development
PROD_REGISTRY: ghcr.io/dtcenter/metexpress/production
DOCKER_HUB: dtcenter/metexpress-production
jobs:
build:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: true
matrix:
deploy: # List of apps to deploy
- met-airquality
- met-anomalycor
- met-cyclone
- met-ensemble
- met-precip
- met-object
- met-surface
- met-upperair
steps:
- name: Create lowercase app names
# Docker tags must be lowercase
env:
APP: '${{ matrix.deploy }}'
run: |
echo "APP_NAME=${APP,,}" >> $GITHUB_ENV
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PAT_RANDY }}
- name: Pull image
run: |
docker pull ${{ env.DEV_REGISTRY }}/${{ env.APP_NAME }}:${GITHUB_REF#refs/tags/}
- name: Retag image
run: |
docker tag ${{ env.DEV_REGISTRY }}/${{ env.APP_NAME }}:${GITHUB_REF#refs/tags/} \
${{ env.PROD_REGISTRY }}/${{ env.APP_NAME }}:${GITHUB_REF#refs/tags/}
docker tag ${{ env.DEV_REGISTRY }}/${{ env.APP_NAME }}:${GITHUB_REF#refs/tags/} \
${{ env.DOCKER_HUB }}:${{ env.APP_NAME }}-${GITHUB_REF#refs/tags/}
- name: Push image
run: |
docker push ${{ env.PROD_REGISTRY }}/${{ env.APP_NAME }}:${GITHUB_REF#refs/tags/}
docker push ${{ env.DOCKER_HUB }}:${{ env.APP_NAME }}-${GITHUB_REF#refs/tags/}