Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ci): Adjust CI for workflow dispatch #368

Merged
merged 3 commits into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/tag.yml → .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Tag
name: Deploy to Development

on:
push:
tags:
Expand Down Expand Up @@ -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: |
Expand All @@ -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 }}
48 changes: 48 additions & 0 deletions .github/workflows/prod.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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