/
githubmirror
/
babel
Обзор
Документация
Войти
/
githubmirror
/
babel
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
.github/workflows/release.yml
294 строки
10 KB
Nicolò Ribaudo
Remove `--all` from release workflow (#18080)
17 июн 2026, 12:04
Не верифицирован
17 июн 2026, 12:04
ad85241
Код
Авторство
О чём код?
name: Release on: push: tags: ["v*"] workflow_dispatch: inputs: version: # Often minor versions require human intervention, so it's safer if we # force ourselves to always create them locally. description: ⚠️ This workflow can only automatically release patch versions, or Babel 8 pre-releases required: true default: patch type: choice options: - prerelease - patch - "8.0.0" permissions: contents: read jobs: log-updates: name: Log packages to publish runs-on: ubuntu-latest steps: - name: Checkout the new tag uses: actions/checkout@v6 with: fetch-depth: 0 - name: This release will publish the following packages run: | if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then yarn release-tool version --dry ${{ github.event.inputs.version }} else git diff --name-only HEAD^..HEAD fi; ensure-npm-packages-exist: name: Ensure npm packages exist runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v6 - name: Use Node.js latest uses: actions/setup-node@v6 with: node-version: latest check-latest: true cache: "yarn" - name: Install run: yarn install - name: Ensure npm packages exist run: | node ./scripts/ensure-packages-exist.ts --check-only git-version: permissions: contents: write # for Git to git push name: Create git tag and commit runs-on: ubuntu-latest needs: - ensure-npm-packages-exist if: github.event_name == 'workflow_dispatch' outputs: branch: ${{ steps.branch-name.outputs.branch }} steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Set @babel-bot as committer run: | git config user.name "Babel Bot" git config user.email "babel-bot@users.noreply.github.com" - name: Create new version run: | make new-version-checklist yarn release-tool version -f @babel/standalone --yes ${{ github.event.inputs.version }} - name: Compute temporary branch name id: branch-name run: | branch="release/temp/$(git describe --abbrev=0)" echo $branch echo "branch=$branch" >> $GITHUB_OUTPUT - name: Push to GitHub run: | git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:"${{ steps.branch-name.outputs.branch }}" --follow-tags npm-release: name: Build, Test and Publish runs-on: ubuntu-latest needs: - git-version - ensure-npm-packages-exist environment: npm permissions: id-token: write # The default condition is success(), but this is false when one of the previous jobs is skipped if: | always() && (needs.git-version.result == 'success' || needs.git-version.result == 'skipped') && needs.ensure-npm-packages-exist.result == 'success' steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Use Node.js latest uses: actions/setup-node@v6 with: node-version: latest check-latest: true package-manager-cache: false # Never use the cache in release builds to avoid cache poisoning. - name: Checkout the temporary branch if: needs.git-version.result == 'success' run: git checkout ${{ needs.git-version.outputs.branch }} - name: Set @babel-bot as committer run: | git config user.name "Babel Bot" git config user.email "babel-bot@users.noreply.github.com" - name: Build and Test run: make prepublish env: # Hack: use FORCE_COLOR so that supports-color@5 returns true for GitHub CI # Remove once `chalk` is bumped to 4.0. FORCE_COLOR: true - name: Publish to npm run: yarn release-tool publish --yes --provenance # Uncomment when Babel 8 becomes stable and the website migrated to Babel 8 # - name: Generate babel-types docs # continue-on-error: true # run: | # mkdir build # node ./packages/babel-types/scripts/generators/docs.ts > ./build/types.md # # - name: Upload babel-types docs # continue-on-error: true # uses: actions/upload-artifact@v7 # with: # name: babel-types-docs # path: build/types.md # retention-days: 3 github-release: name: Create GitHub release draft runs-on: ubuntu-latest needs: - git-version - ensure-npm-packages-exist outputs: is-main: ${{ steps.is-main.outputs.result == 1 }} changelog: ${{ steps.changelog.outputs.changelog }} version: ${{ steps.tags.outputs.new }} steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Check if releasing from main id: is-main uses: babel/actions/ref-matches-branch@v2 with: name: main - name: Checkout the temporary branch if: needs.git-version.result == 'success' run: git checkout ${{ needs.git-version.outputs.branch }} - name: Get tag info id: tags uses: babel/actions/get-release-tags@v2 with: prefix: v8 - name: Generate the changelog id: changelog uses: babel/actions/generate-lerna-changelog@v2 with: from: ${{ steps.tags.outputs.old }} to: ${{ steps.tags.outputs.new }} filter: v8 env: GITHUB_AUTH: ${{ secrets.GITHUB_TOKEN }} - name: Create a draft GitHub release uses: babel/actions/publish-github-release@v2 with: tag: ${{ steps.tags.outputs.new }} changelog: ${{ steps.changelog.outputs.changelog }} token: ${{ secrets.BOT_TOKEN }} github-push: permissions: contents: write # for Git to git push name: Push release commit to "main" runs-on: ubuntu-latest needs: - npm-release - github-release - git-version # The default condition is success(), but this is false when one of the previous jobs is skipped if: | always() && needs.npm-release.result == 'success' && needs.github-release.result == 'success' && needs.github-release.outputs.is-main steps: - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Checkout the temporary branch if: needs.git-version.result == 'success' run: git checkout ${{ needs.git-version.outputs.branch }} - name: Update CHANGELOG.md uses: babel/actions/update-changelog@v2 with: changelog: ${{ needs.github-release.outputs.changelog }} filename: CHANGELOG.md - name: Commit CHANGELOG.md run: | git add CHANGELOG.md git -c user.name="Babel Bot" -c user.email="babel-bot@users.noreply.github.com" \ commit -m "Add ${{ needs.github-release.outputs.version }} to CHANGELOG.md [skip ci]" --no-verify --quiet - name: Push to GitHub run: | git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:main --follow-tags - name: Delete temporary branch from GitHub if: needs.git-version.result == 'success' run: git push "https://babel-bot:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" :${{ needs.git-version.outputs.branch }} # Uncomment when Babel 8 becomes stable # types-docs-updates: # name: Update Babel types docs # runs-on: ubuntu-latest # needs: # - github-release # - github-push # if: | # always() && # needs.github-push.result == 'success' && # needs.github-release.result == 'success' && # needs.github-release.outputs.is-main # steps: # - uses: actions/checkout@v6 # with: # repository: babel/website # fetch-depth: 0 # Otherwise we cannot push # persist-credentials: false # So that we can push with BOT_TOKEN, otherwise it doesn't trigger CI # - name: Download babel-types docs # uses: actions/download-artifact@v8 # with: # name: babel-types-docs # # Downloaded as ./docs/types.md # path: docs # - name: Commit Babel website changes # id: prepare-website-changes # run: | # if [[ -z "$(git status --porcelain=v1 2>/dev/null)" ]] # then # echo "No babel-types docs changes." # exit 0 # else # echo "hasChanges=true" >> $GITHUB_OUTPUT # fi # git checkout -b update-types-docs # git config user.name "Babel Bot" # git config user.email "babel-bot@users.noreply.github.com" # git commit -am "docs: update babel types" # git push --force "https://babel-bot:${{ secrets.BOT_TOKEN }}@github.com/babel/website.git" update-types-docs # - name: Create Pull Request # uses: babel/actions/create-pull-request@v2 # if: steps.prepare-website-changes.outputs.hasChanges == 'true' # with: # token: ${{ secrets.BOT_TOKEN }} # repository: babel/website # branch: update-types-docs # base: main # title: Update Babel types docs # description: Updated `@babel/types` docs for [Babel ${{ needs.github-release.outputs.version }}](https://github.com/babel/babel/releases/tag/${{ needs.github-release.outputs.version }}). # labels: | # docs # repo automation :robot: