|
| 1 | +# Opens a version bump PR for one package. Merge it, then publish a GitHub Release tagged |
| 2 | +# `<package>@<version>` to publish to npm (see release-swc-plugin.yml / release-native-tools.yml). |
| 3 | +name: Bump Version |
| 4 | + |
| 5 | +on: |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + package: |
| 9 | + description: Package |
| 10 | + type: choice |
| 11 | + required: true |
| 12 | + options: |
| 13 | + - swc-plugin |
| 14 | + - native-tools |
| 15 | + bump: |
| 16 | + description: Version increment |
| 17 | + type: choice |
| 18 | + required: true |
| 19 | + default: patch |
| 20 | + options: |
| 21 | + - patch |
| 22 | + - minor |
| 23 | + - major |
| 24 | + |
| 25 | +permissions: |
| 26 | + contents: write |
| 27 | + pull-requests: write |
| 28 | + |
| 29 | +jobs: |
| 30 | + bump: |
| 31 | + name: Bump ${{ inputs.package }} (${{ inputs.bump }}) |
| 32 | + runs-on: ubuntu-latest |
| 33 | + env: |
| 34 | + PACKAGE_DIR: ${{ inputs.package == 'swc-plugin' && 'packages/lingui-macro' || 'packages/native-tools' }} |
| 35 | + steps: |
| 36 | + - uses: actions/checkout@v7 |
| 37 | + |
| 38 | + # Toolchain version comes from rust-toolchain.toml. Needed to refresh Cargo.lock |
| 39 | + # (and, for native-tools, to regenerate binding.js via the `preversion` script). |
| 40 | + - uses: actions-rust-lang/setup-rust-toolchain@v2 |
| 41 | + with: |
| 42 | + build-warnings: warn |
| 43 | + |
| 44 | + - uses: actions/setup-node@v7 |
| 45 | + with: |
| 46 | + node-version-file: .nvmrc |
| 47 | + |
| 48 | + - run: corepack enable |
| 49 | + |
| 50 | + - name: Install dependencies |
| 51 | + run: yarn install --immutable |
| 52 | + |
| 53 | + - name: Bump version |
| 54 | + working-directory: ${{ env.PACKAGE_DIR }} |
| 55 | + run: yarn run -T release-it ${{ inputs.bump }} --ci |
| 56 | + |
| 57 | + - name: Read new version |
| 58 | + id: version |
| 59 | + working-directory: ${{ env.PACKAGE_DIR }} |
| 60 | + run: echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT" |
| 61 | + |
| 62 | + - name: Create pull request |
| 63 | + uses: peter-evans/create-pull-request@v8 |
| 64 | + with: |
| 65 | + branch: chore/${{ inputs.package }}-${{ steps.version.outputs.version }} |
| 66 | + delete-branch: true |
| 67 | + commit-message: "chore: version @lingui/${{ inputs.package }} ${{ steps.version.outputs.version }}" |
| 68 | + title: "chore: version @lingui/${{ inputs.package }} ${{ steps.version.outputs.version }}" |
| 69 | + body: | |
| 70 | + Bumps `@lingui/${{ inputs.package }}` to `${{ steps.version.outputs.version }}` (${{ inputs.bump }}). |
| 71 | +
|
| 72 | + After merging, publish a GitHub Release with tag `${{ inputs.package }}@${{ steps.version.outputs.version }}` to publish it to npm. |
| 73 | +
|
| 74 | + > CI does not run on pull requests opened by GitHub Actions. Close and reopen this PR if you want the checks to run. |
0 commit comments