Skip to content

Commit

Permalink
ci: Update build.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Jun 26, 2024
1 parent 6d05069 commit 32e4d0b
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,23 @@ on:
default: false
required: true
type: boolean
deploy:
description: 'Deploy to K8S'
default: 'Skip'
required: true
type: choice
options:
- Skip
- Staging Only
- Staging + Prod
deployApp:
description: 'App to Deploy'
default: 'ietfwww'
required: true
type: choice
options:
- iabwww
- ietfwww
sandbox:
description: 'Deploy to Sandbox'
default: true
Expand Down Expand Up @@ -188,3 +205,53 @@ jobs:
DEBIAN_FRONTEND: noninteractive
run: |
docker image prune -a -f
# -----------------------------------------------------------------
# STAGING
# -----------------------------------------------------------------
staging:
name: Deploy to Staging
if: ${{ !failure() && !cancelled() && (github.event.inputs.deploy != 'Skip') }}
needs: [build]
runs-on: ubuntu-latest
environment:
name: staging
env:
PKG_VERSION: ${{needs.prepare.outputs.pkg_version}}

steps:
- name: Deploy to staging
uses: the-actions-org/workflow-dispatch@v4
with:
workflow: deploy.yml
repo: ietf-tools/infra-k8s
token: ${{ secrets.GH_INFRA_K8S_TOKEN }}
inputs: '{ "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"${{ github.event.inputs.deployApp }}", "appVersion":"${{ env.PKG_VERSION }}", "remoteRef":"${{ github.sha }}" }'
wait-for-completion: true
wait-for-completion-timeout: 10m
display-workflow-run-url: false

# -----------------------------------------------------------------
# PROD
# -----------------------------------------------------------------
prod:
name: Deploy to Production
if: ${{ !failure() && !cancelled() && github.event.inputs.deploy == 'Staging + Prod' }}
needs: [staging]
runs-on: ubuntu-latest
environment:
name: production
env:
PKG_VERSION: ${{needs.publish.outputs.pkg_version}}

steps:
- name: Deploy to production
uses: the-actions-org/workflow-dispatch@v4
with:
workflow: deploy.yml
repo: ietf-tools/infra-k8s
token: ${{ secrets.GH_INFRA_K8S_TOKEN }}
inputs: '{ "environment":"${{ secrets.GHA_K8S_CLUSTER }}", "app":"${{ github.event.inputs.deployApp }}", "appVersion":"${{ env.PKG_VERSION }}", "remoteRef":"${{ github.sha }}" }'
wait-for-completion: true
wait-for-completion-timeout: 10m
display-workflow-run-url: false

0 comments on commit 32e4d0b

Please sign in to comment.