|
| 1 | +name: Update 0.3.0 WIT Definitions |
| 2 | + |
| 3 | +# Manually dispatch this action from the Actions page |
| 4 | +on: |
| 5 | + workflow_dispatch: |
| 6 | + |
| 7 | +permissions: |
| 8 | + pull-requests: write |
| 9 | + contents: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + update-versions: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + # Checkout the repo and install dependencies |
| 16 | + - name: Checkout repository |
| 17 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 18 | + |
| 19 | + - name: Install cargo-binstall |
| 20 | + uses: cargo-bins/cargo-binstall@8aac5aa2bf0dfaa2863eccad9f43c68fe40e5ec8 # v1.14.1 |
| 21 | + |
| 22 | + # TODO: we don't pin the versions here. It's not great but this will simplify our iteration |
| 23 | + # while we rapidly iterate on these tools. Pin when we're stable. |
| 24 | + - name: Install wit-bindgen |
| 25 | + shell: bash |
| 26 | + run: cargo binstall wit-bindgen-cli |
| 27 | + |
| 28 | + - name: Install wit-deps |
| 29 | + shell: bash |
| 30 | + run: cargo binstall wit-deps-cli |
| 31 | + |
| 32 | + - name: Set version with RC timestamp |
| 33 | + id: version |
| 34 | + run: | |
| 35 | + DATE=$(date +'%Y-%m-%d') |
| 36 | + BASE_VERSION="0.3.0-rc-${DATE}" |
| 37 | + COUNTER=1 |
| 38 | + VERSION="${BASE_VERSION}" |
| 39 | + |
| 40 | + # Check if the tag already exists |
| 41 | + while git ls-remote --tags origin | grep -q "refs/tags/v${VERSION}$"; do |
| 42 | + VERSION="${BASE_VERSION}-${COUNTER}" |
| 43 | + COUNTER=$((COUNTER + 1)) |
| 44 | + done |
| 45 | + |
| 46 | + echo "value=${VERSION}" >> $GITHUB_OUTPUT |
| 47 | + echo "Version will be: ${VERSION}" |
| 48 | +
|
| 49 | + # Update version in WIT definitions |
| 50 | + - name: Update version in WIT files |
| 51 | + run: | |
| 52 | + find wit-0.3.0-draft -name "*.wit" -exec sed -i "s/\(@since(version = \)[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\(-[0-9]\+\)\?\)\?\()\)/\1${{ steps.version.outputs.value }}\4/g" {} + |
| 53 | + find wit-0.3.0-draft -name "*.wit" -exec sed -i "s/\(package wasi:[a-zA-Z0-9_-]\+@\)[0-9]\+\.[0-9]\+\.[0-9]\+\(-rc-[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}\(-[0-9]\+\)\?\)\?/\1${{ steps.version.outputs.value }}/g" {} + |
| 54 | +
|
| 55 | + - name: Update wit deps |
| 56 | + run: | |
| 57 | + cd wit-0.3.0-draft |
| 58 | + wit-deps update || true # Continue even if no deps to update |
| 59 | +
|
| 60 | + # Create PR with changes using create-pull-request action |
| 61 | + - name: Create Pull Request |
| 62 | + uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 |
| 63 | + with: |
| 64 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 65 | + commit-message: "Update 0.3.0 WIT definitions to ${{ steps.version.outputs.value }}" |
| 66 | + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
| 67 | + author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
| 68 | + branch: update-wit-${{ steps.version.outputs.value }} |
| 69 | + title: "Update 0.3.0 WIT definitions to ${{ steps.version.outputs.value }}" |
| 70 | + body: | |
| 71 | + Updates the 0.3.0 WIT definitions with version ${{ steps.version.outputs.value }}. |
| 72 | + |
| 73 | + This is an automated update to rev the RC timestamp. |
| 74 | + |
| 75 | + ## Changes |
| 76 | + - Updated package and since version in WIT files |
| 77 | + - Updated WIT dependencies if applicable |
| 78 | + draft: false |
| 79 | + delete-branch: true |
0 commit comments