Skip to content

update cd

update cd #7

Workflow file for this run

name: CD GitOps
on:
push:
branches: [main]
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and push image to Dockerhub
uses: docker/[email protected]
with:
username: ${{secrets.DOCKER_USERNAME}}
password: ${{secrets.DOCKER_PASSWORD}}
repository: ${{secrets.DOCKER_USERNAME}}/gitopspoc
tags: ${{ github.sha }}, latest
- name: Setup Kustomize
uses: imranismail/setup-kustomize@v1
with:
kustomize-version: "3.6.1"
- name: Update Kubernetes resources
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
cd k8s
kustomize edit set image goserver=$DOCKER_USERNAME/gitopspoc:$GITHUB_SHA
- name: Commit
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Bump docker version"
- name: Debug
run: |
echo "GitHub Token: ${{ secrets.GITHUB_TOKEN }}"
- name: Push
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
repository: gabsferrara/gitOps-POC