• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: Bump version for release
2
3on:
4  workflow_dispatch:
5    inputs:
6      level:
7        description: |
8          Select the level of the release
9        required: true
10        type: choice
11        options:
12          - minor
13          - patch
14
15jobs:
16  bump-version:
17    permissions:
18      id-token: write
19      pull-requests: write
20      contents: write
21
22    runs-on: ubuntu-latest
23    steps:
24      - name: Checkout code
25        uses: actions/checkout@v4
26
27      - name: Configure gitsign
28        uses: chainguard-dev/actions/setup-gitsign@main
29
30      - name: Install cargo-release
31        uses: taiki-e/install-action@v1
32        with:
33          tool: cargo-release
34
35      - name: Install sd
36        uses: taiki-e/install-action@v1
37        with:
38          tool: sd
39
40      - name: Install npm
41        uses: actions/setup-node@v4
42
43      - name: Install doctoc
44        run: npm install doctoc
45
46      - name: Bump version
47        run: |
48          cargo release version ${{ inputs.level }} --execute --no-confirm
49
50      - name: Extract version
51        run: |
52          echo "version=$(cargo pkgid -p bindgen | cut -d '#' -f 2)" >> $GITHUB_ENV
53
54      - name: Update changelog
55        run: |
56          sd "# Unreleased" "# Unreleased\n## Added\n## Changed\n## Removed\n## Fixed\n## Security\n\n# ${{ env.version }} ($(date -I))" CHANGELOG.md
57          ./node_modules/doctoc/doctoc.js CHANGELOG.md
58
59      - name: Create PR
60        uses: peter-evans/create-pull-request@v5
61        with:
62          token: ${{ secrets.GITHUB_TOKEN }}
63          branch: bump-version/${{ env.version }}
64          base: main
65          commit-message: "Bump crates version to ${{ env.version }}"
66          title: "Bump crates version to ${{ env.version }}"
67          body: |
68            This pull request was created automatically by GitHub Actions.
69