Workflow file for this run
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 publish to Docker registry and Helm repo | |
on: | |
release: | |
types: [published] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ github.event.release.target_commitish == 'main' }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.release.target_commitish }} | |
token: ${{ secrets.GH_RELEASE_TOKEN }} | |
submodules: recursive | |
- run: git config --global user.name "GitHub CD bot" | |
- run: git config --global user.email "github-cd-bot@ems.press" | |
- name: Get appVersion from Chart.yaml | |
id: lookupVersion | |
uses: mikefarah/yq@v4.25.2 | |
with: | |
cmd: yq '.appVersion' helm-chart/Chart.yaml | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Push docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
tags: | | |
ghcr.io/ems-press/spf-tools:${{ steps.lookupVersion.outputs.result }}-${{ github.event.release.tag_name }} | |
ghcr.io/ems-press/spf-tools:latest | |
cache-from: type=registry,ref=ghcr.io/ems-press/spf-tools:buildcache | |
cache-to: type=registry,ref=ghcr.io/ems-press/spf-tools:buildcache,mode=max | |
- name: Set up Helm | |
uses: azure/setup-helm@v3 | |
- name: Update chart versions | |
uses: mikefarah/yq@v4.25.2 | |
with: | |
cmd: yq eval -i '.version = "${{ github.event.release.tag_name }}"' helm-chart/Chart.yaml | |
- name: Package and upload Helm chart | |
run: | | |
helm package -u helm-chart | |
# TODO: upload | |
- name: Commit and push updated Helm charts | |
run: | | |
git add helm-chart/ | |
git commit -m "Bump Helm charts to ${{ github.event.release.tag_name }}" | |
git push |