Update chart and docs for release (#12) #4
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: Release | |
on: | |
push: | |
tags: | |
- 'csa-*' | |
jobs: | |
validate-tag: | |
name: Validate tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Validate tag | |
run: | | |
if ! [[ "$GITHUB_REF_NAME" =~ ^csa-[0-9]+.[0-9]+.[0-9]+$ ]]; then | |
echo "Tag does not match expected pattern - got $GITHUB_REF_NAME" | |
exit 1 | |
fi | |
publish-docker-image: | |
name: Publish Docker image | |
runs-on: ubuntu-latest | |
needs: validate-tag | |
steps: | |
- name: Docker metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: expediagroup/container-startup-autoscaler | |
tags: | | |
type=match,pattern=csa-(.*),group=1 | |
- name: Docker setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Docker setup buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker Hub login | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_PASSWORD }} | |
- name: Docker build and push | |
uses: docker/build-push-action@v5 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
publish-helm-chart: | |
name: Publish Helm chart | |
runs-on: ubuntu-latest | |
needs: publish-docker-image | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
version: v3.13.1 | |
- name: Install chart-releaser | |
uses: helm/[email protected] | |
with: | |
install_only: true | |
- name: Run chart-releaser | |
env: | |
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" | |
CR_RELEASE_NAME_TEMPLATE: "chart-{{ .Version }}" | |
run: | | |
owner=$(cut -d '/' -f 1 <<< "$GITHUB_REPOSITORY") | |
repo=$(cut -d '/' -f 2 <<< "$GITHUB_REPOSITORY") | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "[email protected]" | |
rm -rf .cr-release-packages | |
rm -rf .cr-index | |
mkdir -p .cr-release-packages | |
mkdir -p .cr-index | |
cr package charts/container-startup-autoscaler | |
# https://github.com/helm/chart-releaser#create-github-releases-from-helm-chart-packages | |
cr upload -o "$owner" -r "$repo" -c "$(git rev-parse HEAD)" --skip-existing \ | |
--release-notes-file=releasenotes.md --make-release-latest=false | |
# https://github.com/helm/chart-releaser#create-the-repository-index-from-github-releases | |
cr index -o "$owner" -r "$repo" --push |