From 55cfe4d3f5b28db16ad6fdbdaf969c84e842345d Mon Sep 17 00:00:00 2001 From: Don Richards <2738244+DonRichards@users.noreply.github.com> Date: Thu, 19 Oct 2023 09:59:01 -0400 Subject: [PATCH] Incomplete workflow added Signed-off-by: Don Richards <2738244+DonRichards@users.noreply.github.com> --- .github/workflows/deploy_test.yml | 87 ++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 31 deletions(-) diff --git a/.github/workflows/deploy_test.yml b/.github/workflows/deploy_test.yml index 57875fd7b..44521831b 100644 --- a/.github/workflows/deploy_test.yml +++ b/.github/workflows/deploy_test.yml @@ -1,37 +1,62 @@ -name: Deploy to Test Server +name: Deploy and Rollback + on: push: branches: - community_version - tags: - - v* - pull_request: - branches: - - main - - development workflow_dispatch: + inputs: + action: + description: 'Action (deploy/latest or rollback)' + required: true + default: 'deploy/latest' + jobs: - build: - name: build - runs-on: - - self-hosted - - testing - steps: - # Check out current commit - - name: Checkout - uses: actions/checkout@v3 - - - name: Build JHU Image - run: make jhu_up - - - name: Add demo content - run: make jhu_demo_content - - - name: Notify Slack - uses: 8398a7/action-slack@v3 - with: - status: ${{ job.status }} - fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest # selectable (default: repo,message) - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required - if: failure() \ No newline at end of file + build-and-deploy: + if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.action == 'deploy/latest') + name: build and deploy + runs-on: + - self-hosted + - testing + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build JHU Image + run: make jhu_up + + - name: Add demo content + run: make jhu_demo_content + + - name: Notify Slack + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: failure() + + rollback: + if: github.event_name == 'workflow_dispatch' && github.event.inputs.action == 'rollback' + name: rollback + runs-on: + - self-hosted + - testing + steps: + # Add steps here for rolling back your deployment, e.g.: + - name: Checkout previous version + uses: actions/checkout@v3 + with: + ref: ${{ github.event.before }} + + # ... additional rollback steps ... + + - name: Notify Slack + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took,pullRequest + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} + if: failure()