1010 runs-on : ubuntu-latest
1111 outputs :
1212 tags-matrix : ${{ steps.tags-matrix.outputs.result }}
13- latest-release : ${{ steps.latest-release.outputs.result }}
1413 steps :
1514 - uses : actions/checkout@v3
1615 with :
2827 META : ${{ secrets.META_PACKAGE }}
2928 with :
3029 script : |
31- const { PACKAGE, META } = process.env
32- const [{ data: currrentTags }, { data: upstreamTags }] = await Promise.all([
33- github.rest.repos.listTags({
34- owner: context.repo.owner,
35- repo: META.substring(META.indexOf('/') + 1),
36- per_page: 100,
37- }),
38- github.rest.repos.listTags({
39- owner: context.repo.owner,
40- repo: PACKAGE.substring(PACKAGE.indexOf('/') + 1),
41- per_page: 100,
42- }),
43- ])
44- const targetTags = await Promise.allSettled(
45- upstreamTags
46- .filter((tag) => !currrentTags.find((t) => t.name === tag.name))
47- .map((tag) =>
48- github.rest.git
49- .getRef({
50- owner: context.repo.owner,
51- repo: META.substring(META.indexOf('/') + 1),
52- ref: 'tags/' + tag.name,
53- })
54- .then(() => {})
55- .catch((res) => ({ tag: tag.name, status: res.status }))
56- )
57- )
58- return targetTags
59- .filter(({ value }) => value?.status === 404)
60- .map(({ value }) => value.tag)
61-
62- # Can't be used as is: some version release batches don't override latest version
63- # - name: Extract latest release
64- # id: latest-release
65- # env:
66- # TAGS: ${{ steps.tags-matrix.outputs.result }}
67- # run: echo "::set-output name=result::$(jq -r '.[0]' <<< "$TAGS")"
30+ const tags = require('${{ github.workspace }}/.github/scripts/tags.js')
31+ return await tags({ github, context })
6832
6933 tags :
7034 name : Tags
8953 repository : ${{ secrets.META_PACKAGE }}
9054 token : ${{ steps.generate-token.outputs.token }}
9155
92- - name : Create a tag
56+ - name : Retrieve version notes
57+ id : notes
58+ uses : actions/github-script@v6
59+ env :
60+ VERSION : ${{ matrix.tag }}
61+ with :
62+ result-encoding : string
63+ script : |
64+ const notes = require('${{ github.workspace }}/.github/scripts/notes.js')
65+ return await notes({ core, fetch })
66+
67+ - name : Push tag
9368 env :
9469 TAG : ${{ matrix.tag }}
9570 run : |
@@ -98,25 +73,11 @@ jobs:
9873 git tag -a "${TAG}" -m "${TAG}"
9974 git push origin "${TAG}"
10075
101- release :
102- name : Release
103- runs-on : ubuntu-latest
104- needs :
105- - sync
106- - tags
107- if : needs.sync.outputs.tags-matrix != '[]'
108- steps :
109- - name : Generate token
110- uses : tibdex/github-app-token@v1
111- id : generate-token
112- with :
113- app_id : ${{ secrets.BOT_APP_ID }}
114- private_key : ${{ secrets.BOT_PRIVATE_KEY }}
115-
116- - name : Create a release
76+ - name : Publish release
11777 uses : softprops/action-gh-release@v1
11878 with :
11979 repository : ${{ secrets.META_PACKAGE }}
12080 token : ${{ steps.generate-token.outputs.token }}
121- body : WordPress ${{ needs.sync.outputs.latest-release }}
122- tag_name : ${{ needs.sync.outputs.latest-release }}
81+ body : ${{ steps.notes.outputs.result }}
82+ name : Version ${{ matrix.tag }}
83+ tag_name : ${{ matrix.tag }}
0 commit comments