From 922da3ffcc37ba3f0aeaba30fe7cb9471eef076e Mon Sep 17 00:00:00 2001 From: qtrinh2 Date: Wed, 13 Nov 2024 17:47:00 -0500 Subject: [PATCH] updating cicd.yml to support automated deployments --- .github/workflows/cicd.yml | 105 +++++-------------------------------- 1 file changed, 14 insertions(+), 91 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 4a60a5e..78d9038 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -1,102 +1,25 @@ -name: Build & Publish +name: "[crdh] Build, Release, Deploy" on: + workflow_dispatch: push: branches: - "main" - "preview" -env: - REGISTRY: ghcr.io - IMAGE_NAME: "ghcr.io/${{ github.repository }}" - jobs: - build: - runs-on: ubuntu-latest - - permissions: - packages: write - - steps: - - uses: actions/checkout@v3 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v2 - with: - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - registry: ${{ env.REGISTRY }} - - - name: Build and Push Docker Image for Local Dev - uses: docker/build-push-action@v4 - with: - context: . - push: true - tags: "${{ env.IMAGE_NAME }}:latest" - platforms: linux/amd64 - - - name: Build Docker Image(devl) - if: github.ref == 'refs/heads/preview' - uses: docker/build-push-action@v4 - with: - context: . - push: false - tags: "${{ env.IMAGE_NAME }}:latest" - platforms: linux/amd64 - build-args: | - configfile=_config-dev.yml - - - name: Build Docker Image (prod) - if: github.ref == 'refs/heads/main' - uses: docker/build-push-action@v4 - with: - context: . - push: false - tags: "${{ env.IMAGE_NAME }}:latest" - platforms: linux/amd64 - build-args: | - configfile=_config-production.yml - - - name: Extract build artifact from docker image - uses: shrink/actions-docker-extract@v2 - id: extract - with: - image: "${{ env.IMAGE_NAME }}:latest" - path: /usr/share/nginx/html/ - - - name: Archive build artifact - run: tar czvf dist.tar.gz -C ${{ steps.extract.outputs.destination }}/html . - - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - path: ./dist.tar.gz - name: dist - - release: - needs: build - uses: chnm/.github/.github/workflows/create-release.yml@main + jekyll-build-release-deploy: + uses: chnm/.github/.github/workflows/jekyll--build-release-deploy.yml@main secrets: inherit with: - github-run-id: "${{ github.run_id }}" - github-workflow: "${{ github.workflow }}" - github-workflow-ref: "${{ github.workflow_ref }}" - github-workflow-sha: "${{ github.workflow_sha }}" - github-workspace: "${{ github.workspace }}" - github-repository: "${{ github.repository }}" - github-repository-owner: "${{ github.repository_owner }}" - github-repository-name: "${{ github.event.repository.name }}" - github-repository-url: "${{ github.repository-url }}" - github-action-ref: "${{ github.action_ref }}" - github-event-name: "${{ github.event_name }}" - github-actor: "${{ github.actor }}" - github-triggering-actor: "${{ github.triggering_actor }}" - github-base-ref: "${{ github.base_ref }}" - github-ref-name: "${{ github.ref_name }}" - github-ref-type: "${{ github.ref_type }}" - github-ref: "${{ github.ref }}" - github-sha: "${{ github.sha }}" - build-artifact-name: "dist" - release-artifact-tarball-filename: "dist.tar.gz" + container-registry: "ghcr.io" + container-image-name: "crdh" + context-root: "." + devl-url: "https://dev.crdh.rrchnm.org" + prod-url: "https://crdh.rrchnm.org" + + build-artifact-name: "crdh" release-tag-name-type: "iso" - + + website-devl-fqdn: "dev.crdh.rrchnm.org" + website-prod-fqdn: "crdh.rrchnm.org"