Merge pull request #120 from okto-hq/main #47
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: Continuous Deployment | |
on: | |
push: | |
branches: | |
- release | |
- temp-nish | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
app_build: | |
runs-on: ci-arm-runner | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
- name: Log in to registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Build & push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
builder: ${{ steps.buildx.outputs.name }} | |
context: "." | |
file: "deployment/Dockerfile" | |
push: true | |
tags: "${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.run_id }}" | |
cache-from: type=gha | |
cache-to: type=gha,mode=max,ignore-error=true | |
app_deploy: | |
runs-on: ubuntu-latest | |
needs: app_build | |
env: | |
BRANCH: "infra" | |
IMAGE_TAG: ${{ github.run_id }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.BRANCH }} | |
- uses: fregante/setup-git-user@v2 | |
- name: Helm App Version Update | |
run: | | |
found_ver=$(yq -e '.version' ./k8s/values.yaml); | |
echo "Updating app version to $IMAGE_TAG from $found_ver"; | |
yq -ie ".version=\"$IMAGE_TAG\"" ./k8s/values.yaml | |
- name: Helm App Version commit & push | |
run: | | |
git commit -am "Updating app version to $IMAGE_TAG" | |
git push |