From fdb49dceece876f64f24211f14ff7b69e1d24487 Mon Sep 17 00:00:00 2001 From: Jerry Wang Date: Wed, 24 Apr 2024 09:59:09 -0700 Subject: [PATCH] only deploy to dev and test when merge to develop --- .../bcat-build-and-deploy-dev-test.yml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/bcat-build-and-deploy-dev-test.yml diff --git a/.github/workflows/bcat-build-and-deploy-dev-test.yml b/.github/workflows/bcat-build-and-deploy-dev-test.yml new file mode 100644 index 0000000..be3ea38 --- /dev/null +++ b/.github/workflows/bcat-build-and-deploy-dev-test.yml @@ -0,0 +1,62 @@ +name: BCAT build and deploy to OpenShift (dev, test) + +on: + pull_request: + branches: + - 'develop' + +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./.pipeline + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Build BCAT app + run: | + oc version + oc login --token=${{ secrets.OPENSHIFT_TOKEN}} --server=${{ secrets.OPENSHIFT_SERVER_URL }} + npm ci + DEBUG=* npm run build -- --pr=${{ github.event.pull_request.number }} --git.branch.name=${{github.head_ref}} --git.ref=${{github.head_ref}} + + deploy-to-dev: + runs-on: ubuntu-latest + needs: [build] + defaults: + run: + working-directory: ./.pipeline + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Deploy to dev + run: | + oc version + oc login --token=${{ secrets.OPENSHIFT_TOKEN}} --server=${{ secrets.OPENSHIFT_SERVER_URL }} + npm ci + DEBUG=* npm run deploy -- --pr=${{ github.event.pull_request.number }} --env=dev --git.branch.name=${{github.head_ref}} --git.ref=${{github.head_ref}} + + deploy-to-test: + needs: [build, deploy-to-dev] + environment: + name: test + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./.pipeline + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: '16' + - name: Deploy to test + run: | + oc version + oc login --token=${{ secrets.OPENSHIFT_TOKEN}} --server=${{ secrets.OPENSHIFT_SERVER_URL }} + npm ci + DEBUG=* npm run deploy -- --pr=${{ github.event.pull_request.number }} --env=test --git.branch.name=${{github.head_ref}} --git.ref=${{github.head_ref}}