mirror of
https://github.com/revanced/revanced-static-api.git
synced 2025-04-29 22:24:37 +02:00
64 lines
1.7 KiB
YAML
64 lines
1.7 KiB
YAML
name: Update static files
|
|
|
|
on:
|
|
repository_dispatch:
|
|
workflow_dispatch:
|
|
inputs:
|
|
output-branch:
|
|
descripton: "Branch to push static files to"
|
|
required: true
|
|
|
|
jobs:
|
|
update:
|
|
name: Update static files
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: 3.11.3
|
|
|
|
- name: Write config file
|
|
run: echo "${{ vars.CONFIG }}" > config.json
|
|
|
|
- name: Check if a deployment exists
|
|
run: |
|
|
if git ls-remote --exit-code --heads origin ${{ inputs.output-branch }}; then
|
|
echo "::set-output name=deployment-exists::true"
|
|
else
|
|
echo "::set-output name=deployment-exists::false"
|
|
fi
|
|
id: check_deployment
|
|
|
|
- name: Restore deployment if it exists
|
|
if: steps.check_deployment.outputs.deployment-exists == 'true'
|
|
run: |
|
|
git config user.name revanced-bot
|
|
git config user.email github@revanced.app
|
|
git subtree add --prefix=static/ origin/${{ inputs.output-branch }} --squash
|
|
|
|
- name: Update static files
|
|
run: |
|
|
poetry install
|
|
poetry run python main.py
|
|
|
|
- name: Commit changes
|
|
uses: EndBug/add-and-commit@v9
|
|
with:
|
|
message: "chore: Update static files"
|
|
fetch: false
|
|
push: false
|
|
|
|
- name: Deploy
|
|
uses: s0/git-publish-subdir-action@develop
|
|
env:
|
|
REPO: self
|
|
BRANCH: ${{ inputs.output-branch }}
|
|
FOLDER: static
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|