Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Commit f02b65e

Browse files
yoshuawuytsricochet
authored andcommitted
Add "update" github action
1 parent 7ad5908 commit f02b65e

File tree

2 files changed

+66
-2
lines changed

2 files changed

+66
-2
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
permissions:
1717
id-token: write
1818
packages: write
19-
contents: read
19+
contents: write
2020

2121
steps:
2222
# Checkout the repo and install dependencies
@@ -45,7 +45,7 @@ jobs:
4545
with:
4646
registry: ghcr.io
4747
username: ${{ github.actor }}
48-
password: ${{ secrets.GITHUB_TOKEN }}
48+
password: ${{ secrets.ORG_PAT }}
4949

5050
# Build our `.wit` files into a Wasm binary
5151
- name: Build

.github/workflows/update.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Create a PR to upgrade WIT to a new version
2+
3+
# Manually dispatch this action from the Actions page
4+
on:
5+
workflow_dispatch:
6+
inputs:
7+
prev_version:
8+
description: 'Upgrading from version (without the v)'
9+
required: true
10+
type: string
11+
next_version:
12+
description: 'Upgrading to version (without the v)'
13+
required: true
14+
type: string
15+
16+
permissions:
17+
pull-requests: write
18+
contents: write
19+
20+
jobs:
21+
update-versions:
22+
runs-on: ubuntu-latest
23+
steps:
24+
# Checkout the repo and install dependencies
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
- name: Install cargo-binstall
28+
uses: cargo-bins/[email protected]
29+
- name: Install wit-bindgen
30+
shell: bash
31+
run: cargo binstall wit-bindgen-cli
32+
- name: Install wit-deps
33+
shell: bash
34+
run: cargo binstall wit-deps-cli
35+
36+
# echo input
37+
- name: Print the versions
38+
run: echo Upgrading from ${{ inputs.prev_version }} to ${{ inputs.next_version }}
39+
40+
# upgrade
41+
- name: Upgrade tag
42+
run: find . -type f -name "*.wit" -exec sed -i "s/${{ inputs.prev_version }}/${{ inputs.next_version }}/g" {} +
43+
- name: Upgrade wit deps
44+
run: wit-deps update
45+
- name: Generate markdown
46+
run: wit-bindgen markdown wit --html-in-md --all-features
47+
48+
# file PR
49+
- name: Create feature branch
50+
env:
51+
FEATURE_BRANCH: release-v${{ inputs.next_version }}
52+
run: |
53+
git config user.name "github-actions[bot]"
54+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
55+
git add .
56+
git checkout -b $FEATURE_BRANCH
57+
git push -u origin $FEATURE_BRANCH
58+
git commit -m "Update to v${{ inputs.next_version }}"
59+
git push
60+
61+
- name: Create pull request
62+
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!'
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)