Updated constants #179
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: Build & Deploy Production | |
on: | |
push: | |
branches: [master] | |
jobs: | |
build-docker-images: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
node: [16] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set current date as env variable | |
run: echo "NOW=$(date +'%Y-%m-%dT%H:%M:%S')" >> $GITHUB_ENV | |
- name: Set Short SHA variable | |
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-7`" >> $GITHUB_ENV | |
- name: Get Latest tag | |
id: latesttag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
fallback: 'UNKNOWN' # Optional fallback tag to use when no tag can be found | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
with: | |
version: latest | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push production image (AMD64) | |
uses: docker/build-push-action@v2 | |
with: | |
file: provisioning/production/Dockerfile | |
platforms: linux/amd64 | |
push: true | |
tags: | | |
maelstromeous/ps2alerts:api-production-${{ github.sha }} | |
maelstromeous/ps2alerts:api-production-latest | |
build-args: | | |
BUILD_SHA=${{ env.SHORT_SHA }} | |
BUILT=${{ env.NOW }} | |
VERSION=${{ steps.latesttag.outputs.tag }} | |
- name: Build and push production image (ARM64) | |
uses: docker/build-push-action@v2 | |
with: | |
file: provisioning/production/Dockerfile | |
platforms: linux/arm64 | |
push: true | |
tags: | | |
maelstromeous/ps2alerts:api-production-arm | |
build-args: | | |
BUILD_SHA=${{ env.SHORT_SHA }} | |
BUILT=${{ env.NOW }} | |
VERSION=${{ steps.latesttag.outputs.tag }} | |
# deploy-to-k8s: | |
# needs: build-docker-images | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v4 | |
# with: | |
# fetch-depth: 0 | |
# submodules: true | |
# | |
# - name: Find and replace version | |
# uses: jacobtomlinson/gha-find-replace@v2 | |
# with: | |
# find: "{{ version }}" | |
# replace: "${{ github.sha }}" | |
# include: provisioning/production/values.yaml | |
# | |
# - name: Deploy Helm | |
# uses: glopezep/helm@v1.7.1 | |
# with: | |
# helm: helm3 | |
# release: ps2alerts-api-production | |
# namespace: ps2alerts | |
# chart: provisioning/helm/charts/microservice | |
# secrets: ${{ toJSON(secrets) }} | |
# token: ${{ github.token }} | |
# value-files: provisioning/production/values.yaml | |
# version: ${{ github.sha }} | |
# # timeout: 120s # Apparently this isn't supported but it's in the docs? :shrug: | |
# env: | |
# KUBECONFIG_FILE: "${{ secrets.KUBE_CONFIG_RAW }}" |