|
| 1 | +name: Release Pipeline |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + branches: |
| 8 | + - main |
| 9 | + - '[0-9].*' |
| 10 | + - '[0-9][0-9].*' |
| 11 | + workflow_dispatch: |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 15 | + cancel-in-progress: true |
| 16 | + |
| 17 | +jobs: |
| 18 | + split: |
| 19 | + name: Subtree Split |
| 20 | + runs-on: ubuntu-latest |
| 21 | + permissions: |
| 22 | + contents: write |
| 23 | + steps: |
| 24 | + - name: Generate App Token |
| 25 | + id: generate_token |
| 26 | + uses: tibdex/github-app-token@v2 |
| 27 | + with: |
| 28 | + app_id: ${{ secrets.API_PLATFORM_APP_ID }} |
| 29 | + private_key: ${{ secrets.API_PLATFORM_APP_PRIVATE_KEY }} |
| 30 | + |
| 31 | + - name: Checkout repository |
| 32 | + uses: actions/checkout@v4 |
| 33 | + with: |
| 34 | + token: ${{ steps.generate_token.outputs.token }} |
| 35 | + fetch-depth: 0 |
| 36 | + |
| 37 | + - name: Install splitsh |
| 38 | + run: | |
| 39 | + curl -L https://github.com/splitsh/lite/releases/download/v1.0.1/lite_linux_amd64.tar.gz > lite_linux_amd64.tar.gz |
| 40 | + tar -zxpf lite_linux_amd64.tar.gz |
| 41 | + chmod +x splitsh-lite |
| 42 | + echo "$(pwd)" >> $GITHUB_PATH |
| 43 | +
|
| 44 | + - name: Split to manyrepo |
| 45 | + run: find src -maxdepth 3 -name composer.json -print0 | xargs -I '{}' -n 1 -0 bash subtree.sh {} ${{ github.ref }} |
| 46 | + |
| 47 | + dispatch-distribution-update: |
| 48 | + name: Dispatch Distribution Update |
| 49 | + runs-on: ubuntu-latest |
| 50 | + needs: split |
| 51 | + if: startsWith(github.ref, 'refs/tags/') |
| 52 | + steps: |
| 53 | + - name: Generate App Token |
| 54 | + id: generate_token |
| 55 | + uses: tibdex/github-app-token@v2 |
| 56 | + with: |
| 57 | + app_id: ${{ secrets.API_PLATFORM_APP_ID }} |
| 58 | + private_key: ${{ secrets.API_PLATFORM_APP_PRIVATE_KEY }} |
| 59 | + |
| 60 | + - name: Update distribution |
| 61 | + env: |
| 62 | + GH_TOKEN: ${{ steps.generate_token.outputs.token }} |
| 63 | + run: gh workflow run -R api-platform/api-platform release.yml -f tag=${{ github.ref_name }} |
0 commit comments