Merge pull request #33 from Sefaria/dev #70
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: Helm | |
on: | |
push: | |
paths: | |
- "helm-chart/**" | |
- ".github/workflows/helm.yaml" | |
jobs: | |
lint: | |
name: "Lint" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Set up Helm | |
uses: azure/setup-helm@v1 | |
with: | |
version: v3.5.0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Set up chart-testing | |
uses: helm/[email protected] | |
with: | |
version: v3.5.1 | |
- name: Lint chart | |
run: ct lint --charts helm-chart/sefaria-project | |
chart: | |
name: Release Chart | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write # needed to write releases | |
needs: | |
- lint | |
if: | | |
(github.repository == 'sefaria/sefaria-project') | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# Fetch entire history. Required for chart-releaser; see https://github.com/helm/chart-releaser-action/issues/13#issuecomment-602063896 | |
fetch-depth: 0 | |
- name: fetch head of branch to ensure semantic can run | |
run: git pull origin $GITHUB_REF | |
- name: create release rules | |
run: helm-chart/release-rules.sh | |
- uses: cycjimmy/semantic-release-action@v4 | |
id: semantic | |
with: | |
working_directory: ./helm-chart | |
extra_plugins: | | |
[email protected] | |
@semantic-release/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup | |
shell: bash | |
run: | | |
git config --global user.name "$GITHUB_ACTOR" | |
git config --global user.email "[email protected]" | |
- name: Get appVersion | |
id: appVersion | |
run: | | |
echo "appVersion=$(git describe --match 'v*' --abbrev=0 HEAD --tags)" >> $GITHUB_OUTPUT | |
- name: Get chartVersion | |
id: chartVersion | |
run: | | |
if [[ -z "${{ steps.semantic.outputs.new_release_version }}" ]]; then | |
if [[ -z "$(git tag --points-at HEAD -l 'helm*')" ]]; then | |
echo "No chart version available" | |
exit 1 | |
else | |
echo "chartVersion=$(git tag --points-at HEAD -l 'helm*' | sed 's/helm-chart-//' )" >> $GITHUB_OUTPUT | |
fi | |
else | |
echo "chartVersion=${{ steps.semantic.outputs.new_release_version }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Download yq | |
run: | | |
wget -nv -nc -O yq https://github.com/mikefarah/yq/releases/download/v4.20.2/yq_linux_amd64 | |
chmod +x yq | |
- name: Update chart version | |
run: ./yq -i e '.version = "${{ steps.semantic.outputs.new_release_version }}"' helm-chart/sefaria-project/Chart.yaml | |
- name: Update chart appVersion | |
run: ./yq -i e '.appVersion = "${{ steps.appVersion.outputs.appVersion }}"' helm-chart/sefaria-project/Chart.yaml | |
- name: Publish Helm charts | |
uses: stefanprodan/helm-gh-pages@master | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
chart_version: ${{ steps.semantic.outputs.new_release_version }} | |
app_version: ${{ steps.appVersion.outputs.appVersion }} | |
charts_dir: helm-chart |