Update Bindings #39
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: Update Bindings | |
on: | |
workflow_dispatch: | |
inputs: | |
sdk_version: | |
description: flipperzero-firmware SDK version | |
type: string | |
required: true | |
jobs: | |
sdk: | |
name: Update SDK bindings | |
runs-on: ubuntu-latest | |
permissions: | |
# SAFETY: A commit authored by the Bot will be pushed | |
contents: write | |
# SAFETY: An update PR will be created by the Bot | |
pull-requests: write | |
steps: | |
- | |
name: Validate SDK version | |
run: echo '${{ github.event.inputs.sdk_version }}' | grep --perl-regexp '^\d+\.\d+\.\d+$' | |
- | |
name: Checkout sources | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349 # v3.7.1 | |
- | |
name: Create branch | |
run: git checkout -b'github-actions/update-bindings/sdk/${{ github.event.inputs.sdk_version }}' | |
- | |
name: Generate bindings | |
id: generate-bindings | |
uses: docker/build-push-action@4f58ea79222b3b9dc2c8bbdd6debcef730109a75 # v6.9.0 | |
with: | |
context: . | |
load: true | |
build-args: 'BRANCH=${{ github.event.inputs.sdk_version }}' | |
file: tools/Dockerfile | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
- | |
name: Copy bindings | |
run: | | |
container="$(docker container create ${{ steps.generate-bindings.outputs.imageid }} --read-only)" | |
docker container cp "${container}":bindings.rs ./crates/sys/src/bindings.rs | |
docker container rm "${container}" | |
- | |
name: Commit changes | |
run: | | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git commit crates/sys/src/bindings.rs \ | |
--message='build(bindings): bump SDK to `${{ github.event.inputs.sdk_version }}`' | |
- | |
name: Push changes | |
run: git push --set-upstream origin 'github-actions/update-bindings/sdk/${{ github.event.inputs.sdk_version }}' | |
- | |
name: Create update Pull Request | |
run: | | |
gh pr create \ | |
--repo='flipperzero-rs/flipperzero' \ | |
--base='main' \ | |
--title='build(bindings): bump SDK to `${{ github.event.inputs.sdk_version }}`' \ | |
--body="${PULL_REQUEST_DESCRIPTION}" \ | |
--label='sdk-update' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PULL_REQUEST_DESCRIPTION: >- | |
# Description | |
This updates SDK bindings to [`${{ github.event.inputs.sdk_version }}`][1]. | |
--- | |
This PR has been automatically created by user @${{ github.triggering_actor }} | |
via `${{ github.workflow }}` workflow. | |
Further changes may added to this pull request. | |
[1]: https://github.com/flipperdevices/flipperzero-firmware/releases/tag/${{ github.event.inputs.sdk_version }} |