Skip to content
name: Deploy newsletters (production)
on:
push:
tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
env:
ECR_REGISTRY: 598984531759.dkr.ecr.us-east-2.amazonaws.com
IMG_PREFIX: industrial-media
jobs:
version:
runs-on: ubuntu-latest
steps:
- id: tag_version
run: |
REF=$(echo $GITHUB_REF | cut -d / -f 3)
[[ "$GITHUB_REF" =~ ^refs/tags.*$ ]] && VERSION="$REF" || VERSION="${REF}-${GITHUB_SHA::7}"
echo "version=$VERSION" >> $GITHUB_OUTPUT
outputs:
version: ${{ steps.tag_version.outputs.version }}
notify-start:
needs: [version]
uses: parameter1/actions/.github/workflows/notify-start.yml@main
secrets: inherit
with:
version: ${{ needs.version.outputs.version }}
post-deploy-failure:
if: failure()
needs: [notify-start, build-newsletters, deploy-newsletters]
uses: parameter1/actions/.github/workflows/notify-fail.yml@main
secrets: inherit
with:
slack-thread: ${{ needs.notify-start.outputs.slack-thread }}
post-deploy-complete:
if: success()
needs: [notify-start, build-newsletters, deploy-newsletters]
uses: parameter1/actions/.github/workflows/notify-complete.yml@main
secrets: inherit
with:
slack-thread: ${{ needs.notify-start.outputs.slack-thread }}
######################
# Add tenants here! #
######################
build-newsletters:
needs: [version]
runs-on: ubuntu-latest
strategy:
matrix:
tenant:
- multi
steps:
- uses: actions/checkout@v3
- name: Log in to ECR
uses: docker/login-action@v2
with:
registry: ${{ env.ECR_REGISTRY }}
username: ${{ secrets.AWS_ACCESS_KEY_ID }}
password: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Build docker image
uses: docker/build-push-action@v3
with:
push: true
build-args: |
TENANT=${{ matrix.tenant }}
tags: ${{ env.ECR_REGISTRY }}/base-cms-newsletters:${{ env.IMG_PREFIX }}-${{ matrix.tenant }}-${{ needs.version.outputs.version }}
deploy-newsletters:
needs: [version, build-newsletters]
runs-on: ubuntu-latest
strategy:
matrix:
namespace:
- tauron-newsletters
tenant:
- multi
steps:
- name: Deploy to Kubernetes
run: |
npx @parameter1/rancher2cli dl \
--wait --namespace ${{ matrix.namespace }} \
basecms-newsletter ${{ env.IMG_PREFIX }}-${{ matrix.tenant }} \
${{ env.ECR_REGISTRY }}/base-cms-newsletters:${{ env.IMG_PREFIX }}-${{ matrix.tenant }}-${{ needs.version.outputs.version }}
env:
RANCHER_CLUSTERID: ${{ secrets.RANCHER_CLUSTERID_BASECMS }}
RANCHER_TOKEN: ${{ secrets.RANCHER_TOKEN }}
RANCHER_URL: ${{ secrets.RANCHER_URL }}