Skip to content

Create AltStore source #7059

Create AltStore source

Create AltStore source #7059

Workflow file for this run

name: Create AltStore source
on:
schedule:
- cron: '0 */1 * * *' # Run every hour
workflow_dispatch:
permissions:
contents: write
jobs:
create-source:
name: Check for updates and generate source
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4.1.0
- name: Setup Python
uses: actions/setup-python@v4.7.1
with:
cache: pip
- name: Install dependencies
uses: py-actions/py-dependency-install@v4.0.0
- name: Copy .env-example to .env
run: cp .env.example .env
- name: Restore lastGenerated.json
id: restore_last_generated
uses: actions/cache/restore@v3
with:
path: cache/lastGenerated.json
key: lastGenerated
restore-keys: |
lastGenerated-
- name: Run generate.py
run: python3 generate.py
env:
API_KEY: ${{ secrets.GITHUB_TOKEN }}
- name: Check if new source was generated
id: check_file
uses: andstor/file-existence-action@v2.0.0
with:
files: 'out/apps.json'
- name: Save lastGenerated.json
if: steps.check_file.outputs.files_exists == 'true'
uses: actions/cache/save@v3
with:
path: cache/lastGenerated.json
key: lastGenerated-${{ hashFiles('cache/lastGenerated.json') }}
- name: Get the new version
id: json_properties
if: steps.check_file.outputs.files_exists == 'true'
uses: zoexx/github-action-json-file-properties@1.0.4
with:
file_path: cache/lastGenerated.json
- name: Create redirect file, copy apps.json, set CNAME
if: steps.check_file.outputs.files_exists == 'true'
run: |
mkdir pages
cp out/apps.json pages/
cat > pages/index.html <<EOL
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='altstore://source?url=https://enmity.burrito.software/apps.json'" />
<title>Redirecting to altstore://source?url=https://enmity.burrito.software/apps.json</title>
</head>
<body>
Redirecting to <a href="altstore://source?url=https://enmity.burrito.software/apps.json">altstore://source?url=https://enmity.burrito.software/apps.json</a>.
</body>
</html>
EOL
cat > pages/CNAME <<EOL
enmity.burrito.software
EOL
- name: Deploy to GitHub Pages
if: steps.check_file.outputs.files_exists == 'true'
uses: crazy-max/ghaction-github-pages@v4.0.0
with:
target_branch: pages
build_dir: pages
commit_message: "Update source to ${{ steps.json_properties.outputs.buildVersion }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}