mirror of
https://github.com/minecraft-linux/mcpelauncher-versiondb.git
synced 2024-11-13 13:59:21 +00:00
72 lines
2.1 KiB
YAML
72 lines
2.1 KiB
YAML
name: Generate minified versions
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- "**"
|
|
workflow_dispatch:
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
strategy:
|
|
matrix:
|
|
config:
|
|
- branch: ${{ github.ref_name }}
|
|
# Sync branches
|
|
- ${{ fromjson(vars.BRANCH_SYNC_MATRIX || '[]') }}
|
|
exclude:
|
|
# disable branch sync for non default branch
|
|
- config:
|
|
m: ${{ github.ref_name != github.event.repository.default_branch && 1 || -1 }}
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Checkout Deploy (existing branch)
|
|
uses: actions/checkout@v3
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
id: checkout-deploy
|
|
continue-on-error: true
|
|
with:
|
|
path: deploy
|
|
ref: ${{ matrix.config.branch }}
|
|
- name: Checkout Deploy (create branch)
|
|
uses: actions/checkout@v3
|
|
if: steps.checkout-deploy.outcome != 'success'
|
|
with:
|
|
path: deploy
|
|
- name: Set up Python 3.11
|
|
uses: actions/setup-python@v4
|
|
with:
|
|
python-version: 3.11
|
|
- name: Update files
|
|
env:
|
|
PYTHONPATH: ${{ github.workspace }}
|
|
CODES: ${{ tojson(matrix.config.codes) }}
|
|
shell: python
|
|
run: |
|
|
import os
|
|
import json
|
|
import versiondb
|
|
list = versiondb.VersionList('.')
|
|
codes = json.loads(os.getenv('CODES'))
|
|
list.save(codes)
|
|
list.save_minified('armeabi-v7a', codes)
|
|
list.save_minified('x86', codes)
|
|
list.save_minified('arm64-v8a', codes)
|
|
list.save_minified('x86_64', codes)
|
|
- name: copy to deploy
|
|
run: |
|
|
cp versions.json versions.*.json.min deploy/
|
|
- name: Update git
|
|
if: startsWith(github.ref, 'refs/heads/')
|
|
run: |
|
|
# from https://github.com/orgs/community/discussions/26560
|
|
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
|
git config user.name "github-actions[bot]"
|
|
(git add . && git commit -m "Update minified json's" && git push origin HEAD:refs/heads/${{ matrix.config.branch }}) || :
|
|
working-directory: deploy
|