Skip to content

fix: handle upgrades with secret (#204) #169

fix: handle upgrades with secret (#204)

fix: handle upgrades with secret (#204) #169

Workflow file for this run

name: semantic release
on:
push:
branches: [main]
paths-ignore:
- "*.md"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions: {}
jobs:
vars:
name: Set Variables
outputs:
release_exists: ${{ steps.release_check.outputs.release_exists }}
permissions:
contents: read
packages: write
runs-on: ubuntu-24.04
timeout-minutes: 1
steps:
# Get PR number for squash merges to main
- name: PR Number
id: pr
uses: bcgov/actions/get-pr@0992e41cd11c5370b77f9e6066effe63efe9f8c9 # v0.4.0
- name: Checkout
uses: actions/checkout@v7.0.1
- name: Metabase Version
id: metabase_version
run: |
appVersion="$(bash .github/scripts/get-metabase-version.sh)"
echo "app version is $appVersion"
echo "app_version=$appVersion" >> "$GITHUB_OUTPUT"
- name: Check existing GitHub release
id: release_check
shell: bash
run: |
releaseTag="${{ github.event.repository.name }}-${APP_VERSION#v}"
echo "release_tag=$releaseTag" >> "$GITHUB_OUTPUT"
gh release view "$releaseTag" >/dev/null 2>&1 && echo "release_exists=true" >> "$GITHUB_OUTPUT" || echo "release_exists=false" >> "$GITHUB_OUTPUT"
env:
APP_VERSION: ${{ steps.metabase_version.outputs.app_version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: shrink/actions-docker-registry-tag@e6aaef25c595b6e0edd18bf4c7dbfea3abd43299 # v5
with:
registry: ghcr.io
repository: ${{ github.repository }}/metabase
target: ${{ steps.pr.outputs.pr }}
tags: |
${{ steps.metabase_version.outputs.app_version }}
helm-release:
needs: vars
if: needs.vars.outputs.release_exists != 'true'
permissions:
contents: write
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v7.0.1
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: package helm chart
shell: bash
run: |
APP_VERSION="$(bash .github/scripts/get-metabase-version.sh)"
VERSION="${APP_VERSION#v}"
echo "APP_VERSION=$APP_VERSION"
echo "VERSION=$VERSION"
helm package -u --destination=.cr-release-packages --app-version="$APP_VERSION" --version=$VERSION charts/${{ github.event.repository.name }}
- name: Run chart-releaser
# Pinned to v1.5.0: v1.6.0+ has a regression where cr.sh crashes with
# "latest_tag: unbound variable" when skip_packaging is true, because
# latest_tag is only ever assigned in the skip_packaging=false branch
# but is read unconditionally afterward. See:
# https://github.com/helm/chart-releaser-action/issues/171
uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
with:
skip_packaging: "true"