diff --git a/.github/workflows/tag.yml b/.github/workflows/dev.yml similarity index 88% rename from .github/workflows/tag.yml rename to .github/workflows/dev.yml index 564e99219..cead1c3ae 100644 --- a/.github/workflows/tag.yml +++ b/.github/workflows/dev.yml @@ -1,4 +1,5 @@ -name: Tag +name: Deploy to Development + on: push: tags: @@ -81,7 +82,7 @@ jobs: with: cmd: | yq -i '.drupal.tag = strenv(GITHUB_REFERENCE) | - .nginx.tag = strenv(GITHUB_REFERENCE) ' tenant-gitops/helm-drupal/charts/drupal/values-mfin-data-catalogue.yaml + .nginx.tag = strenv(GITHUB_REFERENCE) ' tenant-gitops/helm-drupal/charts/drupal/values-mfin-data-catalogue-dev.yaml - name: Commit files run: | @@ -97,3 +98,15 @@ jobs: branch: main directory: tenant-gitops repository: bcgov-c/tenant-gitops-ea352d + + - name: Deploy to Test Workflow + uses: peter-evans/workflow_dispatch@v2 + with: + workflow: 'Deploy to Test' + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Deploy to Prod Workflow + uses: peter-evans/workflow_dispatch@v2 + with: + workflow: 'Deploy to Prod' + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/prod.yml b/.github/workflows/prod.yml new file mode 100644 index 000000000..e02209cb4 --- /dev/null +++ b/.github/workflows/prod.yml @@ -0,0 +1,48 @@ +name: Deploy to Prod + +on: + workflow_dispatch: + inputs: + approve: + description: 'Approve Deploy to Test.' + required: true + +jobs: + build: + if: ${{ github.event.inputs.approve == 'true' }} + steps: + - uses: actions/checkout@master + + - name: Checkout Tenant GitOps Repo + uses: actions/checkout@v3 + with: + repository: bcgov-c/tenant-gitops-ea352d + path: tenant-gitops + ssh-key: ${{ secrets.SSH_KEY }} + persist-credentials: true + + - name: Update Argo CD + uses: mikefarah/yq@v4.34.1 + env: + GITHUB_REFERENCE: ${{ github.event.inputs.tag }} + with: + cmd: | + yq -i '.drupal.tag = strenv(GITHUB_REFERENCE) | + .nginx.tag = strenv(GITHUB_REFERENCE) ' tenant-gitops/helm-drupal/charts/drupal/values-mfin-data-catalogue-prod.yaml + + - name: Commit files + env: + GITHUB_REFERENCE: ${{ github.event.inputs.tag }} + run: | + cd tenant-gitops + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git commit -a -m "feat(helm): Update container images to ${{ env.GITHUB_REFERENCE }}" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + ssh: true + branch: main + directory: tenant-gitops + repository: bcgov-c/tenant-gitops-ea352d diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..b5a4007e1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,49 @@ +name: Deploy to Test + +on: + workflow_dispatch: + inputs: + approve: + description: 'Approve Deploy to Test.' + required: true + +jobs: + build: + if: ${{ github.event.inputs.approve == 'true' }} + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@master + + - name: Checkout Tenant GitOps Repo + uses: actions/checkout@v3 + with: + repository: bcgov-c/tenant-gitops-ea352d + path: tenant-gitops + ssh-key: ${{ secrets.SSH_KEY }} + persist-credentials: true + + - name: Update Argo CD + uses: mikefarah/yq@v4.34.1 + env: + GITHUB_REFERENCE: ${{ github.event.inputs.tag }} + with: + cmd: | + yq -i '.drupal.tag = strenv(GITHUB_REFERENCE) | + .nginx.tag = strenv(GITHUB_REFERENCE) ' tenant-gitops/helm-drupal/charts/drupal/values-mfin-data-catalogue-test.yaml + + - name: Commit files + env: + GITHUB_REFERENCE: ${{ github.event.inputs.tag }} + run: | + cd tenant-gitops + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git commit -a -m "feat(helm): Update container images to ${{ env.GITHUB_REFERENCE }}" + + - name: Push changes + uses: ad-m/github-push-action@master + with: + ssh: true + branch: main + directory: tenant-gitops + repository: bcgov-c/tenant-gitops-ea352d