METexpress v5.2.1 #19
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/} |