Update SDK #122
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 SDK | |
on: | |
schedule: | |
- cron: '30 0 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
check: | |
name: Check for update | |
runs-on: ubuntu-latest | |
outputs: | |
update: ${{ steps.output.outputs.update }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get URL | |
run: bash .github/get_url.sh > tmp | |
- name: Check for updates | |
id: check | |
continue-on-error: true | |
run: | | |
head -n1 tmp > url | |
tail -n1 tmp > tag | |
git --no-pager show --format=%s --no-patch > commit | |
diff -i -w tag commit | |
- name: Set result in output variable | |
id: output | |
if: steps.check.outcome != 'success' | |
run: echo "update=1" >> "$GITHUB_OUTPUT" | |
fetch: | |
name: Fetch new update | |
runs-on: ubuntu-latest | |
needs: check | |
if: ${{ needs.check.outputs.update > 0 }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Get URL | |
run: bash .github/get_url.sh > ~/url | |
- name: Fetch new zip | |
run: wget -O ~/file $(head -n1 ~/url) | |
- name: Remove repository files | |
run: rm -rf * | |
- name: Extract new files | |
run: unzip ~/file | |
- name: Adjust file locations | |
run: | | |
mv SDK/* . | |
rmdir SDK | |
- name: Check-in new files | |
run: git add . | |
- name: Commit update | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "github-actions[bot]@users.noreply.github.com" | |
git commit -m $(tail -n1 ~/url) | |
git tag $(tail -n1 ~/url) | |
git push | |
git push --tags |