mirror of
https://github.com/revanced/revanced-static-api.git
synced 2025-04-30 06:34:30 +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:
|
on:
|
||||||
repository_dispatch:
|
repository_dispatch:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
output-branch:
|
||||||
|
descripton: "Branch to push static files to"
|
||||||
|
required: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
update:
|
||||||
@ -24,7 +28,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Check if a deployment exists
|
- name: Check if a deployment exists
|
||||||
run: |
|
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"
|
echo "::set-output name=deployment-exists::true"
|
||||||
else
|
else
|
||||||
echo "::set-output name=deployment-exists::false"
|
echo "::set-output name=deployment-exists::false"
|
||||||
@ -36,12 +40,12 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git config user.name revanced-bot
|
git config user.name revanced-bot
|
||||||
git config user.email github@revanced.app
|
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
|
- name: Update static files
|
||||||
run: |
|
run: |
|
||||||
pip install requests
|
poetry install
|
||||||
python src/main.py
|
poetry run python main.py
|
||||||
|
|
||||||
- name: Commit changes
|
- name: Commit changes
|
||||||
uses: EndBug/add-and-commit@v9
|
uses: EndBug/add-and-commit@v9
|
||||||
@ -54,6 +58,6 @@ jobs:
|
|||||||
uses: s0/git-publish-subdir-action@develop
|
uses: s0/git-publish-subdir-action@develop
|
||||||
env:
|
env:
|
||||||
REPO: self
|
REPO: self
|
||||||
BRANCH: gh-pages
|
BRANCH: ${{ inputs.output-branch }}
|
||||||
FOLDER: static
|
FOLDER: static
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
@ -4,7 +4,7 @@ Repository to host a static API using GitHub workflows.
|
|||||||
|
|
||||||
## How it works
|
## 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 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.
|
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.
|
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