33 lines
1.1 KiB
YAML
33 lines
1.1 KiB
YAML
on:
|
|
push:
|
|
branches: [ main ]
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- uses: benjlevesque/short-sha@v3.0
|
|
id: short-sha
|
|
with:
|
|
length: 10
|
|
- uses: gerlero/brew-install@v1
|
|
with:
|
|
packages: buildpacks-community/kpack-cli/kp
|
|
- name: Configure kubectl
|
|
uses: azure/k8s-set-context@v1
|
|
with:
|
|
kubeconfig: ${{ secrets.KUBE_CONFIG }}
|
|
- name: Update kpack image
|
|
env:
|
|
SHA: ${{ github.sha }}
|
|
SHORT_SHA: ${{ steps.short-sha.outputs.sha }}
|
|
run: |
|
|
kp image patch tutorial-image --replace-additional-tag "ghcr.io/hvg-dev/php-test:sha-${SHORT_SHA}" --git-revision "${SHA}" -n test-builder
|
|
- name: Wait for build to complete
|
|
run: |
|
|
BUILD=$(kubectl -n test-builder get image tutorial-image -o jsonpath='{.status.buildCounter}')
|
|
kp build logs tutorial-image -n test-builder --build ${BUILD}
|
|
# - name: Update Kubernetes deployment
|
|
# run: |
|
|
# kubectl set image deployment/my-app my-app=<registry>/<repository>:${{ github.sha }}
|