diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c4e2c100f..a5841045c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -163,11 +163,10 @@ jobs: if [[ "$version" == *"alpha"* ]] || [[ "$version" == *"beta"* ]] || [[ "$version" == *"rc"* ]]; then build_type="prerelease" is_prerelease=true - # TODO: Temporary change - currently allows alpha versions to also create latest tags - # After the version is stable, you need to remove the following line and restore the original logic (latest is created only for stable versions) - if [[ "$version" == *"alpha"* ]]; then + # Current policy: create latest tags for stable releases and selected prereleases (alpha/beta). + if [[ "$version" == *"alpha"* ]] || [[ "$version" == *"beta"* ]]; then create_latest=true - echo "🧪 Building Docker image for prerelease: $version (temporarily allowing creation of latest tag)" + echo "🧪 Building Docker image for prerelease: $version (creating latest tag)" else echo "🧪 Building Docker image for prerelease: $version" fi @@ -216,11 +215,10 @@ jobs: v*alpha*|v*beta*|v*rc*|*alpha*|*beta*|*rc*) build_type="prerelease" is_prerelease=true - # TODO: Temporary change - currently allows alpha versions to also create latest tags - # After the version is stable, you need to remove the if block below and restore the original logic. - if [[ "$input_version" == *"alpha"* ]]; then + # Current policy: create latest tags for stable releases and selected prereleases (alpha/beta). + if [[ "$version" == *"alpha"* ]] || [[ "$version" == *"beta"* ]]; then create_latest=true - echo "🧪 Building with prerelease version: $input_version (temporarily allowing creation of latest tag)" + echo "🧪 Building with prerelease version: $input_version (creating latest tag)" else echo "🧪 Building with prerelease version: $input_version" fi @@ -351,9 +349,7 @@ jobs: # Add channel tags for prereleases and latest for stable if [[ "$CREATE_LATEST" == "true" ]]; then - # TODO: Temporary change - the current alpha version will also create the latest tag - # After the version is stabilized, the logic here remains unchanged, but the upstream CREATE_LATEST setting needs to be restored. - # Stable release (and temporary alpha versions) + # Create latest tags for stable releases and selected prereleases when CREATE_LATEST=true. TAGS="$TAGS,${{ env.REGISTRY_DOCKERHUB }}:latest${VARIANT_SUFFIX},${{ env.REGISTRY_GHCR }}:latest${VARIANT_SUFFIX},${{ env.REGISTRY_QUAY }}:latest${VARIANT_SUFFIX}" elif [[ "$BUILD_TYPE" == "prerelease" ]]; then # Prerelease channel tags (alpha, beta, rc) @@ -450,10 +446,9 @@ jobs: "prerelease") echo "🧪 Prerelease Docker image has been built with ${VERSION} tags" echo "⚠️ This is a prerelease image - use with caution" - # TODO: Temporary change - alpha versions currently create the latest tag - # After the version is stable, you need to restore the following prompt information - if [[ "$VERSION" == *"alpha"* ]] && [[ "$CREATE_LATEST" == "true" ]]; then - echo "🏷️ Latest tag has been created for alpha version (temporary measures)" + # Create latest tags for stable releases and selected prereleases when CREATE_LATEST=true. + if [[ "$CREATE_LATEST" == "true" ]]; then + echo "🏷️ Latest tag has been created for prerelease: $VERSION" else echo "🚫 Latest tag NOT created for prerelease" fi diff --git a/.github/workflows/helm-package.yml b/.github/workflows/helm-package.yml index d808ee184..f0a1a23fb 100644 --- a/.github/workflows/helm-package.yml +++ b/.github/workflows/helm-package.yml @@ -18,6 +18,13 @@ on: workflow_run: workflows: [ "Build and Release" ] types: [ completed ] + workflow_dispatch: + inputs: + version: + description: "Release version to publish, e.g. 1.0.0-beta.1 or v1.0.0-beta.1" + required: true + default: "1.0.0-beta.1" + type: string permissions: contents: read @@ -25,11 +32,13 @@ permissions: jobs: build-helm-package: runs-on: ubicloud-standard-2 - # Only run on successful builds triggered by tag pushes (version format: x.y.z or x.y.z-suffix) if: | - github.event.workflow_run.conclusion == 'success' && - github.event.workflow_run.event == 'push' && - contains(github.event.workflow_run.head_branch, '.') + github.event_name == 'workflow_dispatch' || + ( + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'push' && + contains(github.event.workflow_run.head_branch, '.') + ) outputs: raw_tag: ${{ steps.version.outputs.raw_tag }} @@ -44,7 +53,11 @@ jobs: run: | set -eux - RAW="${{ github.event.workflow_run.head_branch }}" + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + RAW="${{ github.event.inputs.version }}" + else + RAW="${{ github.event.workflow_run.head_branch }}" + fi case "$RAW" in refs/tags/*) @@ -65,12 +78,10 @@ jobs: echo "raw_tag=$RAW_TAG" >> "$GITHUB_OUTPUT" echo "version=$VERSION" >> "$GITHUB_OUTPUT" - echo "raw_tag=$RAW_TAG" - echo "version=$VERSION" - - - name: Replace chart app version + - name: Replace chart version and app version run: | set -eux + sed -i -E 's/^version:.*/version: "${{ steps.version.outputs.version }}"/' helm/rustfs/Chart.yaml sed -i -E 's/^appVersion:.*/appVersion: "${{ steps.version.outputs.version }}"/' helm/rustfs/Chart.yaml - name: Set up Helm @@ -78,6 +89,7 @@ jobs: - name: Package Helm Chart run: | + set -eux cp helm/README.md helm/rustfs/ helm package ./helm/rustfs \ --destination helm/rustfs/ \ @@ -116,9 +128,9 @@ jobs: - name: Push helm package and index file run: | + set -eux git config --global user.name "${{ secrets.USERNAME }}" git config --global user.email "${{ secrets.EMAIL_ADDRESS }}" - git status . git add . - git commit -m "Update rustfs helm package with ${{ needs.build-helm-package.outputs.version }}." + git commit -m "Update rustfs helm package with ${{ needs.build-helm-package.outputs.version }}." || echo "No changes to commit" git push origin main