1.21.50.07 #247
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |