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: "Setup Python, Poetry and Dependencies" uses: packetcoders/action-setup-cache-python-poetry@main with: python-version: 3.11.3 poetry-version: 1.6.1 - 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 }}