Sync #6605
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: Sync | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
scan: | |
name: Detect releases | |
runs-on: ubuntu-latest | |
outputs: | |
releases: ${{ steps.fetch.outputs.releases }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Fetch releases | |
id: fetch | |
run: | | |
.github/workflows/github_fetch_releases.sh 'openswoole/ext-openswoole' > official_releases.json | |
.github/workflows/github_fetch_releases.sh '${{ github.repository }}' > mirrored_releases.json | |
.github/workflows/json_array_diff.sh 'tag_name' official_releases.json mirrored_releases.json > pending_releases.json | |
echo 'releases<<~\\~' >> $GITHUB_OUTPUT | |
jq 'reverse | .[0:100]' pending_releases.json >> $GITHUB_OUTPUT | |
echo '~\\~' >> $GITHUB_OUTPUT | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
release: | |
name: Release ${{ matrix.release.tag_name }} | |
needs: scan | |
runs-on: ubuntu-latest | |
if: ${{ needs.scan.outputs.releases != '' && toJson(fromJson(needs.scan.outputs.releases)) != '[]' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
release: ${{ fromJson(needs.scan.outputs.releases) }} | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v3 | |
- name: Create release | |
run: | | |
echo '{ | |
"tag_name": ${{ toJson(matrix.release.tag_name) }}, | |
"name": ${{ toJson(matrix.release.name) }}, | |
"draft": ${{ toJson(matrix.release.draft) }}, | |
"prerelease": ${{ toJson(matrix.release.prerelease) }}, | |
"body": ${{ toJson(matrix.release.html_url) }}, | |
"make_latest": "legacy" | |
}' | .github/workflows/github_create_release.sh '${{ github.repository }}' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |