Update update.yml #320
Workflow file for this run
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 docs and demo | |
on: | |
push: | |
branches-ignore: | |
- 'dependabot/**' | |
paths-ignore: | |
- 'README.md' | |
- 'demo/snake.zip' | |
- 'demo/qr.png' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: $GITHUB_WORKFLOW | |
cancel-in-progress: false | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- run: | | |
sudo apt install curl qrencode nasm python3 -y | |
rm -rf snake | |
git clone --depth=1 -b "$GITHUB_REF_NAME" "https://${{ secrets.PAT }}@github.com/$GITHUB_REPOSITORY" | |
cd snake | |
nasm snake.asm -o snake.com | |
xxd -p snake.com | python3 docs/update.py | |
qrencode -r snake.com -8 -o demo/qr.png | |
zip demo/snake.zip snake.com | |
tar cvf artifact.tar demo | |
- uses: actions/upload-artifact@v4 | |
id: artifact | |
with: | |
path: snake/artifact.tar | |
- run: | | |
cd snake | |
curl -H "Authorization: Bearer ${{ secrets.PAT }}" "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/pages/deployments" -d '{"artifact_id":${{ steps.artifact.outputs.artifact-id }},"pages_build_version":"${{ github.sha }}","oidc_token":'"$( curl -H "Authorization: Bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL" | jq '.value' )}" | |
git config --global user.email "$GITHUB_REPOSITORY_OWNER_ID+$GITHUB_REPOSITORY_OWNER@users.noreply.github.com" | |
git config --global user.name "$GITHUB_REPOSITORY_OWNER" | |
git add . | |
git commit -m "${GITHUB_WORKFLOW,,}" | |
git push |