chore: manifest link update (#285) #172
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: CD-Build | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- "website/**" | |
jobs: | |
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 }} | |
deploy: | |
runs-on: ubuntu-latest | |
needs: | |
- build-and-push | |
defaults: | |
run: | |
shell: bash | |
working-directory: k8s-infra/litmus-docs/base | |
steps: | |
- name: Checking out CD repository | |
uses: actions/checkout@v2 | |
with: | |
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 [email protected] | |
git add . | |
git commit -m "Manifest updated for litmus-docs" | |
git push origin master | |