Skip to content

Merge pull request #44 from tauri-apps/renovate/clap-4.x-lockfile #5

Merge pull request #44 from tauri-apps/renovate/clap-4.x-lockfile

Merge pull request #44 from tauri-apps/renovate/clap-4.x-lockfile #5

name: Update bindings
on:
push:
branches:
- dev
paths:
- Cargo.lock
jobs:
update-linux:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.pack-changes.outputs.changed }}
steps:
- uses: actions/[email protected]
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -yq gcc-14-aarch64-linux-gnu gcc-14-arm-linux-gnueabi
- name: Update Bindings
run: |
cargo run -p update-bindings -- -b -d x86_64-unknown-linux-gnu
cargo run -p update-bindings -- -b -d aarch64-unknown-linux-gnu
cargo run -p update-bindings -- -b -d arm-unknown-linux-gnueabi
- name: Pack Changes
id: pack-changes
run: |
git add .
CHANGED=($(git diff --name-only --staged | xargs))
if [ ${#CHANGED} -gt 0 ]; then
tar -czf update-linux.tar.gz ${CHANGED[@]}
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload Artifact
if: steps.pack-changes.outputs.changed == 'true'
uses: actions/[email protected]
with:
name: update-linux
path: update-linux.tar.gz
update-macos:
runs-on: macos-latest
outputs:
changed: ${{ steps.pack-changes.outputs.changed }}
steps:
- uses: actions/[email protected]
- name: Update Bindings
run: |
cargo run -p update-bindings -- -b -d aarch64-apple-darwin
cargo run -p update-bindings -- -b -d x86_64-apple-darwin
- name: Pack Changes
id: pack-changes
run: |
git add .
CHANGED=($(git diff --name-only --staged | xargs))
if [ ${#CHANGED} -gt 0 ]; then
tar -czf update-macos.tar.gz ${CHANGED[@]}
echo "changed=true" >> "$GITHUB_OUTPUT"
else
echo "changed=false" >> "$GITHUB_OUTPUT"
fi
- name: Upload Artifact
if: steps.pack-changes.outputs.changed == 'true'
uses: actions/[email protected]
with:
name: update-macos
path: update-macos.tar.gz
update-windows:
runs-on: windows-latest
outputs:
changed: ${{ steps.pack-changes.outputs.changed }}
steps:
- uses: actions/[email protected]
- name: Update Bindings
run: |
cargo run -p update-bindings -- -b -d x86_64-pc-windows-msvc
cargo run -p update-bindings -- -b -d aarch64-pc-windows-msvc
cargo run -p update-bindings -- -b -d i686-pc-windows-msvc
- name: Pack Changes
id: pack-changes
run: |
git add .
$changed = @(git diff --name-only --staged)
if ($changed.Length -gt 0) {
tar -czf update-windows.tar.gz $changed
echo "changed=true" >> "$env:GITHUB_OUTPUT"
} else {
echo "changed=false" >> "$env:GITHUB_OUTPUT"
}
- name: Upload Artifact
if: steps.pack-changes.outputs.changed == 'true'
uses: actions/[email protected]
with:
name: update-windows
path: update-windows.tar.gz
merge-changes:
runs-on: ubuntu-latest
needs:
- update-linux
- update-macos
- update-windows
if: needs.update-linux.outputs.changed == 'true' || needs.update-macos.outputs.changed == 'true' || needs.update-windows.outputs.changed == 'true'
steps:
- uses: actions/[email protected]
- name: Download Linux Artifact
if: needs.update-linux.outputs.changed == 'true'
uses: actions/[email protected]
with:
name: update-linux
- name: Download macOS Artifact
if: needs.update-macos.outputs.changed == 'true'
uses: actions/[email protected]
with:
name: update-macos
- name: Download Windows Artifact
if: needs.update-windows.outputs.changed == 'true'
uses: actions/[email protected]
with:
name: update-windows
- name: Merge PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git switch -c update-bindings
RESET_REV=$(git rev-parse HEAD)
${{ needs.update-linux.outputs.changed == 'true'
&& 'echo "Extracting update-linux.tar.gz"
tar -xzf update-linux.tar.gz
rm update-linux.tar.gz'
|| 'echo "No changes in update-linux"' }}
${{ needs.update-macos.outputs.changed == 'true'
&& 'echo "Extracting update-macos.tar.gz"
tar -xzf update-macos.tar.gz
rm update-macos.tar.gz'
|| 'echo "No changes in update-macos"' }}
${{ needs.update-windows.outputs.changed == 'true'
&& 'echo "Extracting update-windows.tar.gz"
tar -xzf update-windows.tar.gz
rm update-windows.tar.gz'
|| 'echo "No changes in update-windows"' }}
git reset ${RESET_REV}
git add .
CHANGED=($(git diff --name-only --staged | xargs))
if [ ${#CHANGED} -gt 0 ]; then
git push --force -u origin update-bindings
FILES=()
for VALUE in ${CHANGED[@]}; do
base64 -w0 "${VALUE}" > "${VALUE}.base64"
FILES+=("-F" "files[][path]=${VALUE}" "-F" "files[][contents]=@${VALUE}.base64")
done
gh api graphql \
-F githubRepository=${GITHUB_REPOSITORY} \
-F branchName=update-bindings \
-F expectedHeadOid=${RESET_REV} \
-F 'commitMessage=chore: update bindings' \
-F [email protected]/api/createCommitOnBranch.graphql \
${FILES}
git pull
gh pr create -f
fi