Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
idabblewith committed Aug 22, 2024
1 parent 41a2b7e commit 289ec7f
Showing 1 changed file with 6 additions and 32 deletions.
38 changes: 6 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ jobs:
build_and_push_production:
runs-on: ubuntu-latest
outputs:
TAG_NAME: ${{ steps.tag.outputs.TAG_NAME }}
steps:
# If necessary for latest tag
# - name: Delay Start
# run: sleep 40
- name: Checkout code
uses: actions/checkout@v3

Expand All @@ -69,41 +70,14 @@ jobs:
id: tag
run: echo "::set-output name=TAG_NAME::${GITHUB_REF#refs/tags/}"

- name: Build Production Image
- name: Build and Push Production Image
env:
VITE_PRODUCTION_BASE_URL: "https://scienceprojects.dbca.wa.gov.au/"
VITE_PRODUCTION_BACKEND_API_URL: "https://scienceprojects.dbca.wa.gov.au/api/v1/"
VITE_PRODUCTION_PROFILES_BASE_URL: "https://profiles.dbca.wa.gov.au/"
VITE_SPMS_VERSION: ${{ steps.tag.outputs.TAG_NAME }}
run: |
docker build . --build-arg VITE_SPMS_VERSION=$VITE_SPMS_VERSION --build-arg VITE_PRODUCTION_PROFILES_BASE_URL=$VITE_PRODUCTION_PROFILES_BASE_URL --build-arg VITE_PRODUCTION_BASE_URL=$VITE_PRODUCTION_BASE_URL --build-arg VITE_PRODUCTION_BACKEND_API_URL=$VITE_PRODUCTION_BACKEND_API_URL --tag ghcr.io/dbca-wa/science-projects-client:${{ steps.tag.outputs.TAG_NAME }}
docker save ghcr.io/dbca-wa/science-projects-client:${{ steps.tag.outputs.TAG_NAME }} | gzip > production-image.tar.gz
- name: Upload Production Image
uses: actions/upload-artifact@v3
with:
name: production-image
path: production-image.tar.gz

finalize_production:
needs: build_and_push_production
runs-on: ubuntu-latest
steps:
- name: Download Production Image
uses: actions/download-artifact@v3
with:
name: production-image

- name: Set up Docker
run: docker login --username idabblewith --password ${{ secrets.GH_PAT }} ghcr.io

- name: Load Production Image
run: |
gunzip -c production-image.tar.gz | docker load
- name: Push Production Image as Latest
run: |
TAG_NAME=${{ needs.build_and_push_production.outputs.TAG_NAME }}
docker tag ghcr.io/dbca-wa/science-projects-client:${TAG_NAME} ghcr.io/dbca-wa/science-projects-client:latest
docker push ghcr.io/dbca-wa/science-projects-client:${TAG_NAME}
docker push ghcr.io/dbca-wa/science-projects-client:${{ steps.tag.outputs.TAG_NAME }}
docker tag ghcr.io/dbca-wa/science-projects-client:${{ steps.tag.outputs.TAG_NAME }} ghcr.io/dbca-wa/science-projects-client:latest
docker push ghcr.io/dbca-wa/science-projects-client:latest

0 comments on commit 289ec7f

Please sign in to comment.