fix ci #56
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: Publish Helm charts | |
# TODO: is it possible to run this workflow only if the check-code-quality workflow has completed successfully ? | |
# I've tried workflow_run but see: | |
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run | |
# Note: This event will only trigger a workflow run if the workflow file is on the default branch. | |
# Run workflow only for new git tags (including hierarchical tags like v1.0/beta), or manually | |
on: | |
push: | |
tags: | |
- '**' | |
branches: | |
- 'feat**' | |
workflow_dispatch: | |
env: | |
DOCKER_REGISTRY: ghcr.io | |
jobs: | |
####################### | |
# Publish Helm charts # | |
####################### | |
rs-server-helm-chart: | |
runs-on: ubuntu-latest | |
name: "rs-server Helm chart" | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # fetch all history for all branches and tags. | |
- name: Get the rs-server version tag | |
id: get_version | |
shell: bash | |
run: | | |
# Enable pipefail so git command failures do not result in null versions downstream | |
set -x | |
echo "SHA_SHORT=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV | |
echo "APP_VERSION=$(\ | |
git ls-remote --tags --refs --sort="v:refname" \ | |
https://github.com/RS-PYTHON/rs-server.git 'v0.*a*' | tail -n1 | sed 's/.*\///' \ | |
)" >> $GITHUB_OUTPUT | |
# v0.1a7 | |
if [ "$GITHUB_REF_TYPE" == "tag" ]; then | |
echo "CHART_VERSION=0.$(echo $GITHUB_REF_NAME | sed 's/.*\///' | sed 's/^v//' | sed 's/^v//' | sed 's/.\{3\}/&-/')" >> $GITHUB_OUTPUT | |
# v0.1a7 => 0.0.1-a7 | |
elif [ "$GITHUB_REF_TYPE" == "branch" ]; then | |
echo "CHART_VERSION=0.$(\ | |
git ls-remote --tags --refs --sort="v:refname" \ | |
https://github.com/RS-PYTHON/rs-server.git 'v0.*a*' | tail -n1 | sed 's/.*\///' | sed 's/^v//' | sed 's/.\{3\}/&-/')-${SHA_SHORT}" >> $GITHUB_OUTPUT | |
# 0.0.1-a7-1tr5hrt | |
fi | |
- name: Update version number in chart.yaml | |
shell: bash | |
run: | | |
for chart in $(find charts -name Chart.yaml); do | |
sed -i "s,{{APP_VERSION}},${{ steps.get_version.outputs.APP_VERSION }}," $chart | |
sed -i "s,{{CHART_VERSION}},${{ steps.get_version.outputs.CHART_VERSION }}," $chart | |
done | |
- id: publish-chart | |
uses: ./.github/actions/publish-chart | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |