mirror of
https://github.com/revanced/revanced-static-api.git
synced 2025-04-29 14:14:33 +02:00
feat: Commit static files to variable branch
This commit is contained in:
parent
c0c91db2df
commit
915db07c72
14
.github/workflows/update.yml
vendored
14
.github/workflows/update.yml
vendored
@ -3,6 +3,10 @@ name: Update static files
|
||||
on:
|
||||
repository_dispatch:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
output-branch:
|
||||
descripton: "Branch to push static files to"
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
update:
|
||||
@ -24,7 +28,7 @@ jobs:
|
||||
|
||||
- name: Check if a deployment exists
|
||||
run: |
|
||||
if git ls-remote --exit-code --heads origin gh-pages; then
|
||||
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"
|
||||
@ -36,12 +40,12 @@ jobs:
|
||||
run: |
|
||||
git config user.name revanced-bot
|
||||
git config user.email github@revanced.app
|
||||
git subtree add --prefix=static/ origin/gh-pages --squash
|
||||
git subtree add --prefix=static/ origin/${{ inputs.output-branch }} --squash
|
||||
|
||||
- name: Update static files
|
||||
run: |
|
||||
pip install requests
|
||||
python src/main.py
|
||||
poetry install
|
||||
poetry run python main.py
|
||||
|
||||
- name: Commit changes
|
||||
uses: EndBug/add-and-commit@v9
|
||||
@ -54,6 +58,6 @@ jobs:
|
||||
uses: s0/git-publish-subdir-action@develop
|
||||
env:
|
||||
REPO: self
|
||||
BRANCH: gh-pages
|
||||
BRANCH: ${{ inputs.output-branch }}
|
||||
FOLDER: static
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
@ -4,7 +4,7 @@ Repository to host a static API using GitHub workflows.
|
||||
|
||||
## How it works
|
||||
|
||||
When CI is ran, static files are generated and commited to the `gh-pages` branch.
|
||||
When CI is ran, static files are generated and commited to the specified branch.
|
||||
The file `generator.py` provides a list of static file generator classes. Each class has a name.
|
||||
The configuration file `config.json` is read which contains the configuration for the API.
|
||||
By specifying the name of the generator in the `generators` array of the configuration, the corresponding generator will be used. The current object of the configuration is passed to the generator.
|
||||
|
Loading…
x
Reference in New Issue
Block a user