Merge pull request #46 from flanksource/yaml-marshalling #28
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: release | |
on: | |
push: | |
branches: | |
- 'main' | |
workflow_dispatch: | |
jobs: | |
semantic-release: | |
runs-on: ubuntu-latest | |
outputs: | |
release-version: ${{ steps.semantic.outputs.release-version }} | |
new-release-published: ${{ steps.semantic.outputs.new-release-published }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: cycjimmy/semantic-release-action@v3 | |
id: semantic | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build-push: | |
runs-on: ubuntu-latest | |
needs: semantic-release | |
permissions: | |
packages: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set version | |
# Always use git tags as semantic release can fail due to rate limit | |
run: | | |
git fetch --prune --unshallow | |
echo "RELEASE_VERSION=$(git describe --abbrev=0 --tags | sed -e 's/^v//')" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Log in to the Github Container Registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: docker.io | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
push: true | |
tags: docker.io/flanksource/tenant-controller:v${{ env.RELEASE_VERSION }} | |
- uses: actions/checkout@v3 | |
with: | |
repository: "${{ github.repository_owner }}/azure-production" | |
token: ${{ secrets.FLANKBOT }} | |
path: ./azure-production | |
- name: Update image tags in azure-production repo | |
uses: mikefarah/yq@9b4082919bf50bb6be38742adf46f888e9f5683a # master | |
with: | |
cmd: yq -i e '.spec.template.spec.containers[0].image = "docker.io/flanksource/tenant-controller:v${{ env.RELEASE_VERSION }}"' azure-production/specs/bases/apps/tenant-controller/deployment.yml | |
- name: Push changes to chart repo | |
uses: stefanzweifel/git-auto-commit-action@3ea6ae190baf489ba007f7c92608f33ce20ef04a # v4.16.0 | |
with: | |
commit_message: "chore: update tenant-controller image version to ${{ env.RELEASE_VERSION }}" | |
repository: ./azure-production | |
branch: main |