NSW LG 2024: Using the new 'overwrite threshold' option on loader con… #56
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: Staging CI/CD | |
on: | |
push: | |
branches: [staging] | |
pull_request: | |
branches: [staging] | |
types: [closed] | |
env: | |
LATEST_IMAGE_TAG: latest-staging | |
jobs: | |
# build-public: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/setup-node@v4 | |
# with: | |
# node-version: '20.x' | |
# - name: Setup Env Vars | |
# run: | | |
# mkdir secrets | |
# mkdir secrets/staging/ | |
# mkdir secrets/dev/ | |
# echo "${{secrets.SAUSAGE_WEB_STAGING_ENV }}" > secrets/staging/sausage-web.staging.env | |
# echo "${{secrets.SAUSAGE_WEB_DB_DEV_ENV }}" > secrets/dev/sausage-web-db.dev.env | |
# echo "${{secrets.SAUSAGE_PUBLIC_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-public-frontend.staging.env | |
# echo "${{secrets.SAUSAGE_PUBLIC_REDESIGN_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-public-redesign-frontend.staging.env | |
# echo "${{secrets.SAUSAGE_ADMIN_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-admin-frontend.staging.env | |
# - name: Build - Prep | |
# run: | | |
# mkdir ./build | |
# mkdir ./nginx-prod/build | |
# - name: Public Frontend - Build | |
# run: docker compose --file build_staging.yml run public | |
# - name: Upload artifact for container build jobs | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: build-public | |
# path: ./nginx-prod/build/public.tgz | |
# build-admin: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/setup-node@v4 | |
# with: | |
# node-version: '20.x' | |
# - name: Setup Env Vars | |
# run: | | |
# mkdir secrets | |
# mkdir secrets/staging/ | |
# mkdir secrets/dev/ | |
# echo "${{secrets.SAUSAGE_WEB_STAGING_ENV }}" > secrets/staging/sausage-web.staging.env | |
# echo "${{secrets.SAUSAGE_WEB_DB_DEV_ENV }}" > secrets/dev/sausage-web-db.dev.env | |
# echo "${{secrets.SAUSAGE_PUBLIC_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-public-frontend.staging.env | |
# echo "${{secrets.SAUSAGE_PUBLIC_REDESIGN_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-public-redesign-frontend.staging.env | |
# echo "${{secrets.SAUSAGE_ADMIN_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-admin-frontend.staging.env | |
# - name: Build - Prep | |
# run: | | |
# mkdir ./build | |
# mkdir ./nginx-prod/build | |
# - name: Public Admin - Build | |
# run: docker compose --file build_staging.yml run admin | |
# - name: Upload artifact for container build jobs | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: build-admin | |
# path: ./nginx-prod/build/admin.tgz | |
build-public-redesign: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Setup Env Vars | |
run: | | |
mkdir secrets | |
mkdir secrets/staging/ | |
mkdir secrets/dev/ | |
echo "${{secrets.SAUSAGE_WEB_STAGING_ENV }}" > secrets/staging/sausage-web.staging.env | |
echo "${{secrets.SAUSAGE_WEB_DB_DEV_ENV }}" > secrets/dev/sausage-web-db.dev.env | |
echo "${{secrets.SAUSAGE_PUBLIC_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-public-frontend.staging.env | |
echo "${{secrets.SAUSAGE_PUBLIC_REDESIGN_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-public-redesign-frontend.staging.env | |
echo "${{secrets.SAUSAGE_ADMIN_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-admin-frontend.staging.env | |
- name: Build - Prep | |
run: | | |
mkdir ./build | |
mkdir ./nginx-prod/build | |
# - name: Setup Debug Session | |
# uses: csexton/debugger-action@master | |
- name: Public Redesign Frontend - Build | |
run: docker compose --file build_staging.yml run public_redesign | |
- name: Upload artifact for container build jobs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-public-redesign | |
path: ./nginx-prod/build/public-redesign.tgz | |
build-django-static: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Setup Env Vars | |
run: | | |
mkdir secrets | |
mkdir secrets/staging/ | |
mkdir secrets/dev/ | |
echo "${{secrets.SAUSAGE_WEB_STAGING_ENV }}" > secrets/staging/sausage-web.staging.env | |
echo "${{secrets.SAUSAGE_WEB_DB_DEV_ENV }}" > secrets/dev/sausage-web-db.dev.env | |
echo "${{secrets.SAUSAGE_PUBLIC_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-public-frontend.staging.env | |
echo "${{secrets.SAUSAGE_PUBLIC_REDESIGN_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-public-redesign-frontend.staging.env | |
echo "${{secrets.SAUSAGE_ADMIN_FRONTEND_STAGING_ENV }}" > secrets/staging/sausage-admin-frontend.staging.env | |
- name: Build - Prep | |
run: | | |
mkdir ./build | |
mkdir ./nginx-prod/build | |
- name: Django - Build | |
run: docker compose --file build_staging.yml run django | |
- name: Upload artifact for container build jobs | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-django | |
path: ./nginx-prod/build/django.tgz | |
build-nginx: | |
runs-on: ubuntu-latest | |
# needs: [build-public, build-admin, build-public-redesign, build-django-static] | |
needs: [build-public-redesign, build-django-static] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build - Prep | |
run: | | |
mkdir ./build | |
mkdir ./nginx-prod/build | |
- name: Download artifacts for container building | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./build/ | |
- name: Move artifacts | |
run: | | |
cp -r ./public-legacy/staging/ ./nginx-prod/build/public-legacy/ | |
cp -r ./admin-legacy/staging/ ./nginx-prod/build/admin-legacy/ | |
mv ./build/build-public-redesign/public-redesign.tgz ./nginx-prod/build/public-redesign.tgz | |
mv ./build/build-django/django.tgz ./nginx-prod/build/django.tgz | |
- name: Containers - Build Nginx | |
run: docker build -t keithmoss/demsausage-nginx:staging-$GITHUB_SHA -t keithmoss/demsausage-nginx:${{ env.LATEST_IMAGE_TAG }} . | |
working-directory: nginx-prod | |
- name: Containers - Push to Docker Hub | |
run: | | |
docker push keithmoss/demsausage-nginx --all-tags | |
build-django: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Containers - Build Django | |
run: docker build -t keithmoss/demsausage-django:staging-$GITHUB_SHA -t keithmoss/demsausage-django:${{ env.LATEST_IMAGE_TAG }} . | |
working-directory: django | |
- name: Containers - Push to Docker Hub | |
run: | | |
docker push keithmoss/demsausage-django --all-tags | |
build-rq-dashboard: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Containers - Build RQ Dashboard | |
run: docker build -t keithmoss/demsausage-rq-dashboard:staging-$GITHUB_SHA -t keithmoss/demsausage-rq-dashboard:${{ env.LATEST_IMAGE_TAG }} . | |
working-directory: rq-dashboard | |
- name: Containers - Push to Docker Hub | |
run: | | |
docker push keithmoss/demsausage-rq-dashboard --all-tags | |
deploy-app: | |
runs-on: ubuntu-latest | |
needs: [build-nginx, build-django, build-rq-dashboard] | |
steps: | |
- name: Deploy to Digital Ocean droplet via SSH action | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_STAGING_HOST }} | |
username: ${{ secrets.SSH_STAGING_USERNAME }} | |
key: ${{ secrets.SSH_STAGING_KEY }} | |
passphrase: ${{ secrets.SSH_STAGING_KEY_PASSPHRASE }} | |
script: | | |
cd /apps/digitalocean-stack/ | |
./demsausage-staging-redeploy.sh |