From 7bc3081c6773ee3f4c42643740f8d6f73b4f0149 Mon Sep 17 00:00:00 2001 From: Yosuf Date: Sun, 12 Jul 2026 10:54:10 +0200 Subject: [PATCH 1/2] Improve release proces - Support manual trigger - Support draft releases (for testing) - Support branch releases (for testing) --- .github/workflows/helm-release.yml | 114 +++++++++++++++++++++-------- 1 file changed, 83 insertions(+), 31 deletions(-) diff --git a/.github/workflows/helm-release.yml b/.github/workflows/helm-release.yml index 8a6af75..d1baf68 100644 --- a/.github/workflows/helm-release.yml +++ b/.github/workflows/helm-release.yml @@ -1,38 +1,101 @@ -# .github/workflows/helm-release.yml name: Release Helm Chart on: + # Auto trigger: plain SemVer tags, e.g. 1.2.3 or 1.2.3-extra-test. push: tags: - - 'filebrowser-quantum-v*' # only triggers on tags like filebrowser-quantum-v1.2.3 + - '*.*.*' + # Manual trigger: run from any branch/commit for testing. The chosen + # ref becomes the chart version, so test packages never collide with + # real semver releases. + workflow_dispatch: + inputs: + dry_run: + description: 'Lint only, do not push to OCI or create a release' + type: boolean + default: false + +env: + CHART_DIR: filebrowser + CHART_NAME: filebrowser-quantum + OCI_REPO: ghcr.io/${{ github.repository_owner }}/helm-charts jobs: + lint: + name: Lint chart + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Helm + uses: azure/setup-helm@v4 + + - name: helm lint + run: helm lint "${CHART_DIR}" + + - name: helm template (render sanity check) + run: helm template test "${CHART_DIR}" > /dev/null + release: + name: Package & publish + needs: lint runs-on: ubuntu-latest permissions: contents: write packages: write - steps: - name: Checkout uses: actions/checkout@v4 with: - fetch-depth: 0 # needed for git-cliff changelog range + fetch-depth: 0 - - name: Extract version from tag + - name: Set up Helm + uses: azure/setup-helm@v4 + + - name: Determine chart version id: version run: | - # strips "filebrowser-quantum-v" prefix → "1.2.3" - VERSION=${GITHUB_REF_NAME#filebrowser-quantum-v} - echo "version=$VERSION" >> $GITHUB_OUTPUT + if [ "${{ github.ref_type }}" = "tag" ]; then + # Tag push -> tag is already valid SemVer, use as-is. + # e.g. 1.2.3 or 1.2.3-extra-test + VERSION="${GITHUB_REF_NAME}" + else + # Manual dispatch on a branch/commit -> version derived from + # the branch name. Sanitized + short-SHA suffixed so Helm + # (which requires valid SemVer) accepts it and repeated test + # runs on the same branch don't overwrite each other's tag. + SAFE_BRANCH=$(echo "${GITHUB_REF_NAME}" \ + | tr '[:upper:]' '[:lower:]' \ + | sed -e 's#[/_]#-#g' -e 's#[^a-z0-9-]##g') + SHORT_SHA=$(git rev-parse --short HEAD) + VERSION="0.0.0-${SAFE_BRANCH}.${SHORT_SHA}" + fi + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "Resolved chart version: ${VERSION}" - - name: Set up Helm - uses: azure/setup-helm@v4 + - name: Set Chart.yaml version + run: | + sed -i "s/^version:.*/version: ${{ steps.version.outputs.version }}/" \ + "${CHART_DIR}/Chart.yaml" + + - name: Package chart + run: helm package "${CHART_DIR}" --version "${{ steps.version.outputs.version }}" --destination . + + - name: Login to GHCR + if: ${{ !inputs.dry_run }} + run: | + echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io \ + -u "${{ github.actor }}" --password-stdin - - name: Lint chart - run: helm lint filebrowser + - name: Push chart to OCI + if: ${{ !inputs.dry_run }} + run: | + helm push "${CHART_NAME}-${{ steps.version.outputs.version }}.tgz" \ + "oci://${OCI_REPO}" - name: Generate changelog + if: ${{ github.ref_type == 'tag' && !inputs.dry_run }} id: changelog uses: orhun/git-cliff-action@v4 with: @@ -41,25 +104,14 @@ jobs: OUTPUT: CHANGELOG.md GITHUB_REPO: ${{ github.repository }} - - name: Update Chart.yaml version - run: | - sed -i "s/^version:.*/version: ${{ steps.version.outputs.version }}/" filebrowser/Chart.yaml - - - name: Login to GHCR - run: | - echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io \ - -u ${{ github.actor }} --password-stdin - - - name: Package and push chart - run: | - helm package filebrowser --version ${{ steps.version.outputs.version }} - helm push filebrowser-quantum-${{ steps.version.outputs.version }}.tgz \ - oci://ghcr.io/${{ github.repository_owner }}/helm-charts - - name: Create GitHub Release + if: ${{ !inputs.dry_run }} uses: softprops/action-gh-release@v2 with: - tag_name: ${{ github.ref_name }} - name: "filebrowser-quantum v${{ steps.version.outputs.version }}" - body: ${{ steps.changelog.outputs.content }} - files: filebrowser-quantum-${{ steps.version.outputs.version }}.tgz + tag_name: ${{ steps.version.outputs.version }} + target_commitish: ${{ github.sha }} + name: "${{ env.CHART_NAME }} v${{ steps.version.outputs.version }}" + draft: ${{ github.ref_type != 'tag' }} + prerelease: ${{ github.ref_type != 'tag' }} + body: ${{ github.ref_type == 'tag' && steps.changelog.outputs.content || format('Test build from `{0}` @ `{1}`. Not an official release — draft only.', github.ref_name, github.sha) }} + files: "${{ env.CHART_NAME }}-${{ steps.version.outputs.version }}.tgz" \ No newline at end of file From 30f5b2babc48086fb48f2125765d98b1af35dc48 Mon Sep 17 00:00:00 2001 From: Yosuf Date: Sun, 12 Jul 2026 11:07:01 +0200 Subject: [PATCH 2/2] Path must be lowercase must be lowercase --- .github/workflows/helm-release.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/helm-release.yml b/.github/workflows/helm-release.yml index d1baf68..f51bd39 100644 --- a/.github/workflows/helm-release.yml +++ b/.github/workflows/helm-release.yml @@ -18,7 +18,6 @@ on: env: CHART_DIR: filebrowser CHART_NAME: filebrowser-quantum - OCI_REPO: ghcr.io/${{ github.repository_owner }}/helm-charts jobs: lint: @@ -53,6 +52,10 @@ jobs: - name: Set up Helm uses: azure/setup-helm@v4 + - name: Set OCI repo (lowercased) + run: | + echo "OCI_REPO=ghcr.io/$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')/helm-charts" >> "$GITHUB_ENV" + - name: Determine chart version id: version run: |