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