Create a PR to upgrade WIT to a new version #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create a PR to upgrade WIT to a new version | |
# Manually dispatch this action from the Actions page | |
on: | |
workflow_dispatch: | |
inputs: | |
prev_version: | |
description: 'Upgrading from version (without the v)' | |
required: true | |
type: string | |
next_version: | |
description: 'Upgrading to version (without the v)' | |
required: true | |
type: string | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
update-versions: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repo and install dependencies | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install cargo-binstall | |
uses: cargo-bins/[email protected] | |
- name: Install wit-bindgen | |
shell: bash | |
run: cargo binstall wit-bindgen-cli | |
- name: Install wit-deps | |
shell: bash | |
run: cargo binstall wit-deps-cli | |
# echo input | |
- name: Print the versions | |
run: echo Upgrading from ${{ inputs.prev_version }} to ${{ inputs.next_version }} | |
# upgrade | |
- name: Upgrade tag | |
run: find . -type f -name "*.wit" -exec sed -i "s/${{ inputs.prev_version }}/${{ inputs.next_version }}/g" {} + | |
- name: Upgrade wit deps | |
run: wit-deps update | |
- name: Generate markdown for the proxy world | |
run: wit-bindgen markdown wit -w proxy --html-in-md --features=informational-outbound-responses | |
- name: Generate markdown for the imports world | |
run: wit-bindgen markdown wit -w imports --html-in-md --features=informational-outbound-responses | |
# file PR | |
- name: Create feature branch | |
env: | |
FEATURE_BRANCH: release-v${{ inputs.next_version }} | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git add . | |
git checkout -b $FEATURE_BRANCH | |
git push -u origin $FEATURE_BRANCH | |
git commit -m "Update to v${{ inputs.next_version }}" | |
git push | |
- name: Create pull request | |
run: gh pr create -B main -H release-v${{ inputs.next_version }} --title 'Release v${{ inputs.next_version }}' --body 'Updates the package version to v${{ inputs.next_version }}. Thanks!' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |