diff --git a/.github/workflows/update-bee-js.yaml b/.github/workflows/update-bee-js.yaml new file mode 100644 index 0000000..74a6e09 --- /dev/null +++ b/.github/workflows/update-bee-js.yaml @@ -0,0 +1,50 @@ +name: Update bee-js + +on: + repository_dispatch: + types: [bee-js-released] + +jobs: + update-bee-js: + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Validate version + env: + VERSION: ${{ github.event.client_payload.version }} + run: | + if ! printf '%s' "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9.-]+)?$'; then + echo "invalid version: $VERSION" >&2; exit 1 + fi + + - name: Update BEE_JS_VERSION in dependency.ts + env: + VERSION: ${{ github.event.client_payload.version }} + run: | + sed -i "s/BEE_JS_VERSION = '\\^[^']*'/BEE_JS_VERSION = '^\$VERSION'/" src/dependency.ts + + - name: Generate App token + id: app-token + uses: actions/create-github-app-token@v1 + with: + app-id: ${{ secrets.BEE_RUNNER_CLIENT_ID }} + private-key: ${{ secrets.BEE_RUNNER_KEY }} + + - name: Create pull request + uses: peter-evans/create-pull-request@v8.1.1 + with: + token: ${{ steps.app-token.outputs.token }} + commit-message: 'chore: update bee-js to v${{ github.event.client_payload.version }}' + branch: update-bee-js-${{ github.event.client_payload.version }} + title: 'chore: update bee-js to v${{ github.event.client_payload.version }}' + body: | + Automated update of `@ethersphere/bee-js` to `^${{ github.event.client_payload.version }}`. + + Please review the [bee-js changelog](https://github.com/ethersphere/bee-js/blob/master/CHANGELOG.md) before merging. + labels: dependencies