Merge pull request #17 from m1ghtym0/feat/cc-workshop #35
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: build and push docker image | |
on: | |
push | |
jobs: | |
release-docker: | |
name: Release docker image | |
if: "!contains(github.event.head_commit.message, '[skip ci]')" | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Get git sha short | |
id: vars | |
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Deploy docker image | |
uses: docker/build-push-action@v3 | |
with: | |
file: ./kubernetes-101/Dockerfile | |
push: true | |
tags: saiyam911/kubeworkshop:sha-${{ steps.vars.outputs.sha_short }} | |
- name: Generate deploy manifest from Jinja template | |
uses: cuchi/[email protected] | |
with: | |
template: kubernetes-101/tmpl/hello.j2 | |
output_file: kubernetes-101/deploy/hello.yaml | |
strict: true | |
variables: | | |
image_deploy_tag=sha-${{ steps.vars.outputs.sha_short }} | |
- name: Commit deploy manifest on local repo | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add . | |
git commit -s -m "[skip ci] Generate deployment manifests" | |
- name: Push deploy manifests to local repo | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.TOKEN_GITHUB }} |