-
-
Notifications
You must be signed in to change notification settings - Fork 8
86 lines (78 loc) · 2.21 KB
/
meta-package.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Meta-package
on:
workflow_call:
workflow_dispatch:
pull_request:
branches:
- main
jobs:
package:
name: Package
runs-on: ubuntu-latest
outputs:
package-name: ${{ steps.package.outputs.package-name }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ vars.META_PACKAGE }}
- name: Get upstream package name
id: package
run: echo "package-name=$(jq -r '.require | map_values(select(. == "self.version")) | keys[0]' composer.json)" >> $GITHUB_OUTPUT
sync:
name: Sync
runs-on: ubuntu-latest
needs:
- package
outputs:
tags-matrix: ${{ steps.tags-matrix.outputs.result }}
steps:
- uses: actions/checkout@v4
- name: Generate matrix from versions arrays
id: tags-matrix
uses: actions/github-script@v7
env:
PACKAGE: ${{ needs.package.outputs.package-name }}
META: ${{ vars.META_PACKAGE }}
with:
script: |
const tags = require('${{ github.workspace }}/.github/scripts/tags.js')
return await tags({ github, context })
tags:
name: Tags
runs-on: ubuntu-latest
needs:
- sync
if: needs.sync.outputs.tags-matrix != '[]'
continue-on-error: true
strategy:
fail-fast: false
matrix:
tag: ${{ fromJSON(needs.sync.outputs.tags-matrix) }}
steps:
- name: Generate token
uses: tibdex/github-app-token@v2
id: generate-token
with:
app_id: ${{ secrets.BOT_APP_ID }}
private_key: ${{ secrets.BOT_PRIVATE_KEY }}
- uses: actions/checkout@v4
with:
repository: ${{ vars.META_PACKAGE }}
token: ${{ steps.generate-token.outputs.token }}
- name: Push tag
env:
TAG: ${{ matrix.tag }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git tag -a "${TAG}" -m "${TAG}"
git push origin "${TAG}"
releases:
name: Releases
needs:
- sync
- tags
uses: ./.github/workflows/release.yml
secrets: inherit
with:
tags-matrix: ${{ needs.sync.outputs.tags-matrix }}