Update .github/workflows/build_push.yml
This commit is contained in:
parent
2e25400a20
commit
edd5dc1752
1 changed files with 44 additions and 19 deletions
63
.github/workflows/build_push.yml
vendored
63
.github/workflows/build_push.yml
vendored
|
@ -22,6 +22,8 @@ jobs:
|
||||||
prepare:
|
prepare:
|
||||||
name: Prepare job
|
name: Prepare job
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
outputs:
|
||||||
|
individualMatrix: ${{ steps.generate-matrices.outputs.individualMatrix }}
|
||||||
steps:
|
steps:
|
||||||
- name: Clone repo
|
- name: Clone repo
|
||||||
uses: https://github.com/actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
uses: https://github.com/actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||||
|
@ -29,23 +31,22 @@ jobs:
|
||||||
ref: main
|
ref: main
|
||||||
token: ${{ secrets.BOT_PAT }}
|
token: ${{ secrets.BOT_PAT }}
|
||||||
|
|
||||||
- name: Find lib changes
|
- name: Get number of modules
|
||||||
id: modified-libs
|
|
||||||
uses: https://github.com/tj-actions/changed-files@90a06d6ba9543371ab4df8eeca0be07ca6054959 #v42
|
|
||||||
with:
|
|
||||||
files: lib/
|
|
||||||
files_ignore: lib/**.md
|
|
||||||
files_separator: " "
|
|
||||||
safe_output: false
|
|
||||||
|
|
||||||
# This step is going to commit, but this will not trigger another workflow.
|
|
||||||
- name: Bump extensions that uses a modified lib
|
|
||||||
if: steps.modified-libs.outputs.any_changed == 'true'
|
|
||||||
run: |
|
run: |
|
||||||
./.github/scripts/bump-versions.py ${{ steps.modified-libs.outputs.all_changed_files }}
|
set -x
|
||||||
|
projects=(src/*/*)
|
||||||
- name: Validate Gradle Wrapper
|
export CI_CHUNK_NUM=${#projects[@]}
|
||||||
uses: https://github.com/gradle/wrapper-validation-action@a494d935f4b56874c4a5a87d19af7afcf3a163d0 # v2
|
echo "NUM_INDIVIDUAL_MODULES=${#projects[@]}" >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Temporary pause because of leak of tj-actions/changed-files
|
||||||
|
# - name: Find lib changes
|
||||||
|
# id: modified-libs
|
||||||
|
# uses: tj-actions/changed-files@90a06d6ba9543371ab4df8eeca0be07ca6054959 #v42
|
||||||
|
# with:
|
||||||
|
# files: lib/
|
||||||
|
# files_ignore: lib/**.md
|
||||||
|
# files_separator: " "
|
||||||
|
# safe_output: false
|
||||||
|
|
||||||
- name: Import GPG key
|
- name: Import GPG key
|
||||||
uses: https://github.com/crazy-max/ghaction-import-gpg@v6 # v6.1.0
|
uses: https://github.com/crazy-max/ghaction-import-gpg@v6 # v6.1.0
|
||||||
|
@ -55,10 +56,33 @@ jobs:
|
||||||
git_user_signingkey: true
|
git_user_signingkey: true
|
||||||
git_commit_gpgsign: true
|
git_commit_gpgsign: true
|
||||||
|
|
||||||
|
# # This step is going to commit, but this will not trigger another workflow.
|
||||||
|
# - name: Bump extensions that uses a modified lib
|
||||||
|
# if: steps.modified-libs.outputs.any_changed == 'true'
|
||||||
|
# run: |
|
||||||
|
# chmod +x ./.github/scripts/bump-versions.py
|
||||||
|
# ./.github/scripts/bump-versions.py ${{ steps.modified-libs.outputs.all_changed_files }}
|
||||||
|
|
||||||
|
- id: generate-matrices
|
||||||
|
name: Create output matrices
|
||||||
|
uses: https://github.com/actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
|
||||||
|
with:
|
||||||
|
script: |
|
||||||
|
const numIndividualModules = process.env.NUM_INDIVIDUAL_MODULES;
|
||||||
|
const chunkSize = process.env.CI_CHUNK_SIZE;
|
||||||
|
|
||||||
|
const numIndividualChunks = Math.ceil(numIndividualModules / chunkSize);
|
||||||
|
|
||||||
|
console.log(`Individual modules: ${numIndividualModules} (${numIndividualChunks} chunks of ${chunkSize})`);
|
||||||
|
|
||||||
|
core.setOutput('individualMatrix', { 'chunk': [...Array(numIndividualChunks).keys()] });
|
||||||
|
|
||||||
build_individual:
|
build_individual:
|
||||||
name: Build individual modules
|
name: Build individual modules
|
||||||
needs: prepare
|
needs: prepare
|
||||||
runs-on: docker
|
runs-on: docker
|
||||||
|
strategy:
|
||||||
|
matrix: ${{ fromJSON(needs.prepare.outputs.individualMatrix) }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout main branch
|
- name: Checkout main branch
|
||||||
uses: https://github.com/actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
uses: https://github.com/actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
|
||||||
|
@ -83,18 +107,19 @@ jobs:
|
||||||
- name: Set up Gradle
|
- name: Set up Gradle
|
||||||
uses: https://github.com/gradle/actions/setup-gradle@245c8a24de79c0dbeabaf19ebcbbd3b2c36f278d # v4
|
uses: https://github.com/gradle/actions/setup-gradle@245c8a24de79c0dbeabaf19ebcbbd3b2c36f278d # v4
|
||||||
|
|
||||||
- name: Build extensions
|
- name: Build extensions (chunk ${{ matrix.chunk }})
|
||||||
env:
|
env:
|
||||||
|
CI_CHUNK_NUM: ${{ matrix.chunk }}
|
||||||
ALIAS: ${{ secrets.ALIAS }}
|
ALIAS: ${{ secrets.ALIAS }}
|
||||||
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
KEY_STORE_PASSWORD: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||||
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD }}
|
||||||
run: chmod +x ./gradlew && ./gradlew -p src assembleRelease
|
run: chmod +x ./gradlew && ./gradlew -p src assembleRelease
|
||||||
|
|
||||||
- name: Upload APKs
|
- name: Upload APKs (chunk ${{ matrix.chunk }})
|
||||||
uses: https://code.forgejo.org/forgejo/upload-artifact@16871d9e8cfcf27ff31822cac382bbb5450f1e1e # v4-patch
|
uses: https://code.forgejo.org/forgejo/upload-artifact@16871d9e8cfcf27ff31822cac382bbb5450f1e1e # v4-patch
|
||||||
if: "github.repository == 'Kohi-den/extensions-source'"
|
if: "github.repository == 'Kohi-den/extensions-source'"
|
||||||
with:
|
with:
|
||||||
name: "individual-apks"
|
name: "individual-apks-${{ matrix.chunk }}"
|
||||||
path: "**/*.apk"
|
path: "**/*.apk"
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue