Updated pipeline for automating docs deployment (#179)

* Updated pipeline for automating docs deployment

Signed-off-by: Jonsy13 <vedant.shrotria@chaosnative.com>

* Updated user to litmusbot

Signed-off-by: Jonsy13 <vedant.shrotria@chaosnative.com>

* Update docker_Push.yml

Co-authored-by: Raj Babu Das <mail.rajdas@gmail.com>
This commit is contained in:
Vedant Shrotria 2022-04-27 17:39:00 +05:30 committed by GitHub
parent 3150db359e
commit 29cedf544b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 18 deletions

View File

@ -8,40 +8,54 @@ on:
- "website/**"
jobs:
cd:
build-and-push:
runs-on: ubuntu-latest
outputs:
TAG: ${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
steps:
- uses: actions/checkout@v2
- name: Declare some variables
id: vars
shell: bash
run: |
echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Docker login
run: echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USER }} --password-stdin
- name: Build and Push the Docker Image
run: |
docker build -t ${GITHUB_REPOSITORY}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }} .
docker push ${GITHUB_REPOSITORY}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }}
netlify-deploy:
deploy:
runs-on: ubuntu-latest
needs:
- build-and-push
defaults:
run:
shell: bash
working-directory: k8s-infra/litmus-docs/base
steps:
- uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
- name: Checking out CD repository
uses: actions/checkout@v2
with:
node-version: 12.x
# Run npm install and build on our code
- run: |
cd website
npm install
npm run build
# Deploy to Netlify using our production secrets
- uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
with:
args: deploy --dir=website/build --prod
ref: "master"
repository: litmuschaos/litmus-cd
token: ${{ secrets.CD_PUSH_TOKEN }}
- name: Updating the manifests and pushing
run: |
tag=${{ needs.build-and-push.outputs.TAG }}
# Deployment Images Update
sed -i -e "s|litmuschaos/litmus-docs:.*|litmuschaos/litmus-docs:$tag|g" litmusdocs-deploy.yaml
git config user.name litmuschaos-bot
git config user.email litmusbot@github.com
git add .
git commit -m "Manifest updated for litmus-docs"
git push origin master