diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 9acc083..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,142 +0,0 @@ -name: Release automation - -# End-to-end docs-release pipeline for builddocs. -# Polls saltstack/salt every 10 min. On a new point release (X.Y where Y > 0): -# 1. Open `topic/release/` PR with version-bump edits to -# build_env.sh and .github/workflows/gh-pages-builddocs.yml -# 2. Wait for required PR checks -# 3. Merge (gh-pages-builddocs.yml then runs on push and builds) -# -# `.0` (LTS-bump) releases are skipped — they rename workflow job keys and -# bump multiple major-version-bearing fields. -# -# Caveat: PRs created with the default GITHUB_TOKEN do not trigger workflows -# that run on `pull_request`. If you want PR-level CI to run, replace -# GH_TOKEN with a PAT or GitHub App token stored as a secret. - -on: - schedule: - - cron: '*/10 * * * *' - workflow_dispatch: - inputs: - salt_version: - description: 'Override salt version (e.g. 3008.1). Blank = auto-detect.' - required: false - type: string - -permissions: - contents: write - pull-requests: write - -concurrency: - group: release-automation - cancel-in-progress: false - -jobs: - release: - runs-on: ubuntu-latest - env: - # gh CLI needs repo context for `pr list/merge/checks/create`. Setting - # GH_REPO at job level means those calls work before checkout (the - # lookup step runs before any checkout). - GH_REPO: ${{ github.repository }} - steps: - - name: Detect target salt version - id: detect - env: - GH_TOKEN: ${{ github.token }} - INPUT_VERSION: ${{ inputs.salt_version }} - run: | - set -euo pipefail - if [[ -n "${INPUT_VERSION:-}" ]]; then - v="$INPUT_VERSION" - else - v=$(gh api repos/saltstack/salt/releases/latest --jq '.tag_name') - fi - v=${v#v} - IFS='.' read -r maj min <<<"$v" - if [[ "${min:-0}" -eq 0 ]]; then - echo "::notice::skipping $v — .0 LTS bumps require manual editing" - echo "skip=true" >> "$GITHUB_OUTPUT" - else - echo "salt_version=$v" >> "$GITHUB_OUTPUT" - echo "branch=topic/release/$v" >> "$GITHUB_OUTPUT" - echo "detected $v" - fi - - - name: Look up existing PR for this version - id: lookup - if: steps.detect.outputs.skip != 'true' - env: - GH_TOKEN: ${{ github.token }} - BRANCH: ${{ steps.detect.outputs.branch }} - run: | - set -euo pipefail - pr=$(gh pr list --state all --head "$BRANCH" \ - --json number,state,mergedAt --jq '.[0] // empty') - if [[ -n "$pr" ]]; then - echo "pr_number=$(echo "$pr" | jq -r '.number')" >> "$GITHUB_OUTPUT" - echo "pr_state=$(echo "$pr" | jq -r '.state')" >> "$GITHUB_OUTPUT" - [[ "$(echo "$pr" | jq -r '.mergedAt // empty')" != "" ]] \ - && echo "merged=true" >> "$GITHUB_OUTPUT" - fi - echo "lookup: $pr" - - - name: Checkout main - if: steps.detect.outputs.skip != 'true' && steps.lookup.outputs.pr_number == '' - uses: actions/checkout@v4 - with: - ref: main - fetch-depth: 0 - - - name: Generate edits and open PR - if: steps.detect.outputs.skip != 'true' && steps.lookup.outputs.pr_number == '' - env: - GH_TOKEN: ${{ github.token }} - BRANCH: ${{ steps.detect.outputs.branch }} - SALT: ${{ steps.detect.outputs.salt_version }} - run: | - set -euo pipefail - git config user.name 'github-actions[bot]' - git config user.email 'github-actions[bot]@users.noreply.github.com' - git checkout -b "$BRANCH" - - old=$(grep -E "^export LATEST_RELEASE=" build_env.sh \ - | sed -E "s/.*='([^']+)'.*/\1/") - new="$SALT" - echo "bumping $old -> $new" - - esc=${old//./\\.} - sed -i "s/'${esc}'/'${new}'/g; s/'v${esc}'/'v${new}'/g" build_env.sh - sed -i "s/'${esc}'/'${new}'/g; s/'v${esc}'/'v${new}'/g" \ - .github/workflows/gh-pages-builddocs.yml - - if git diff --quiet; then - echo "::error::no changes produced for $SALT" - exit 1 - fi - git add -A - git commit -m "Update $(echo "$SALT" | cut -d. -f1) LTS to $SALT" - git push -u origin "$BRANCH" - gh pr create --base main --head "$BRANCH" \ - --title "Update $(echo "$SALT" | cut -d. -f1) LTS to $SALT" \ - --body "Automated bump for Salt $SALT point release." - - - name: Wait for required PR checks - if: steps.detect.outputs.skip != 'true' && steps.lookup.outputs.merged != 'true' - env: - GH_TOKEN: ${{ github.token }} - BRANCH: ${{ steps.detect.outputs.branch }} - run: | - set -euo pipefail - sleep 15 - gh pr checks "$BRANCH" --watch --required || true - - - name: Merge PR - if: steps.detect.outputs.skip != 'true' && steps.lookup.outputs.merged != 'true' - env: - GH_TOKEN: ${{ github.token }} - BRANCH: ${{ steps.detect.outputs.branch }} - run: | - set -euo pipefail - gh pr merge "$BRANCH" --merge