Add backup.yaml file #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: APP (Vue) | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
env: | |
IMAGE_NAME: cas-web | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
CI: true | |
working-directory: ./web | |
codeCov-token: ${{ secrets.CodeCov }} | |
strategy: | |
matrix: | |
node-version: [10.x] | |
steps: | |
# - uses: actions/checkout@v2 | |
# - name: Use Node.js ${{ matrix.node-version }} | |
# uses: actions/setup-node@v1 | |
# with: | |
# node-version: ${{ matrix.node-version }} | |
# - run: npm ci | |
# working-directory: ${{env.working-directory}} | |
# - run: npm run build --if-present --tag web | |
# working-directory: ${{env.working-directory}} | |
- name: Login to Artifactory | |
uses: docker/login-action@v1 | |
with: | |
registry: artifacts.developer.gov.bc.ca | |
username: ${{ secrets.CAS_ARTIFACTORY_USERNAME }} | |
password: ${{ secrets.CAS_ARTIFACTORY_PASSWORD }} | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
# Get SHORT_SHA to tag images | |
- name: Get short SHA | |
id: short_sha | |
run: | | |
echo "::set-output name=SHORT_SHA::$(git rev-parse --short HEAD)" | |
echo "Short SHA: $SHORT_SHA" | |
# - name: Docker Build Backend Image | |
# working-directory: ${{env.working-directory}} | |
# run: | | |
# docker build --tag web . --file Dockerfile | |
# docker tag web artifacts.developer.gov.bc.ca/cac1-cas/${{ env.IMAGE_NAME }}:dev-${{ steps.short_sha.outputs.SHORT_SHA }} | |
# - name: Docker Push to Artifactory | |
# id: publish | |
# run: | | |
# docker push artifacts.developer.gov.bc.ca/cac1-cas/${{ env.IMAGE_NAME }}:dev-${{ steps.short_sha.outputs.SHORT_SHA }} | |
- name: Docker Build Image | |
run: | | |
docker build --tag nginx-runtime -f docker/nginx-runtime/Dockerfile ./docker/nginx-runtime/ | |
cd web | |
docker build --tag ss-web-artifacts -f Dockerfile.node . --build-arg WEB_BASE_HREF=${{ secrets.WEB_BASE_HREF }} | |
cd .. | |
docker build --tag web -f docker/vue-on-nginx/Dockerfile ./docker/vue-on-nginx/ | |
docker tag web artifacts.developer.gov.bc.ca/cac1-cas/${{ env.IMAGE_NAME }}:latest | |
docker push artifacts.developer.gov.bc.ca/cac1-cas/${{ env.IMAGE_NAME }} | |
- name: Checkout ArgoCD Repo | |
id: gitops | |
uses: actions/checkout@v4 | |
with: | |
repository: bcgov-c/tenant-gitops-ac1cc8 | |
ref: develop | |
token: ${{ secrets.GIT_OPS_SSH_KEY }} # `GH_PAT` is a secret that contains your PAT | |
path: gitops | |
- name: Update Helm Values and Commit | |
id: helm | |
if: steps.gitops.outcome == 'success' # Only run if the previous step (publish) was successful | |
run: | | |
# Clone the GitOps deployment configuration repository | |
# Navigate to the directory containing your Helm values file for the environment develop -> DEV, test -> test and | |
cd gitops/charts | |
# Update the Helm values file with the new image tag and version | |
DATETIME=$(date +'%Y-%m-%d %H:%M:%S') # Get current date and time | |
sed -i "s/apitag: .*/apitag: dev-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" ../deploy/dev_values.yaml | |
sed -i "s/apitag: .*/apitag: dev-${{ steps.short_sha.outputs.SHORT_SHA }} # Image Updated on $DATETIME/" web/values.yaml | |
# Commit and push the changes | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git add . | |
git add ../deploy/dev_values.yaml |