Publish new version π #358
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: 'Publish new version π' | |
on: | |
workflow_dispatch: | |
schedule: | |
# every day at 16:00 | |
- cron: '0 16 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
prepare: | |
if: github.event_name == 'schedule' | |
runs-on: ubuntu-22.04 | |
outputs: | |
new-commits: ${{ steps.check-release.outputs.new-commits }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: 'Check if there are commits since the last release' | |
id: check-release | |
#language=sh | |
run: | | |
if [[ -z "$(git log $(git describe --tags --abbrev=0)..HEAD)" ]]; then | |
echo "new-commits=false" >> $GITHUB_OUTPUT | |
else | |
echo "new-commits=true" >> $GITHUB_OUTPUT | |
fi | |
test-unit: | |
needs: prepare | |
if: (always() && github.event_name != 'schedule') || needs.prepare.outputs.new-commits == 'true' | |
uses: ./.github/workflows/--test-unit.yml | |
secrets: inherit | |
test-integration: | |
needs: prepare | |
if: (always() && github.event_name != 'schedule') || needs.prepare.outputs.new-commits == 'true' | |
uses: ./.github/workflows/--test-integration.yml | |
secrets: inherit | |
analyse: | |
needs: prepare | |
if: (always() && github.event_name != 'schedule') || needs.prepare.outputs.new-commits == 'true' | |
uses: ./.github/workflows/--analyse.yml | |
secrets: inherit | |
quality: | |
needs: prepare | |
if: (always() && github.event_name != 'schedule') || needs.prepare.outputs.new-commits == 'true' | |
uses: ./.github/workflows/--quality.yml | |
secrets: inherit | |
release: | |
runs-on: ubuntu-22.04 | |
if: (always() && github.event_name != 'schedule') || needs.prepare.outputs.new-commits == 'true' | |
needs: | |
- test-unit | |
- test-integration | |
- analyse | |
- quality | |
outputs: | |
released: ${{ steps.semantic-release.outputs.released }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
token: ${{ secrets.GH_REPO_TOKEN }} | |
# TODO: Switch to v3 with app credentials when GitHub apps are allowed to bypass the merge queue. https://github.com/orgs/community/discussions/52652#discussioncomment-5647196 | |
- uses: myparcelnl/actions/setup-git-credentials@v2 | |
with: | |
token: ${{ secrets.GH_REPO_TOKEN }} | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GH_REPO_TOKEN }} | |
- uses: myparcelnl/actions/yarn-install@v3 | |
- uses: myparcelnl/actions/semantic-release@v3 | |
id: semantic-release | |
with: | |
token: ${{ secrets.GH_REPO_TOKEN }} | |
write-summary: true | |
rebase-prs: | |
needs: release | |
if: ((always() && github.event_name != 'schedule') || needs.prepare.outputs.new-commits == 'true') && needs.release.outputs.released == 'true' | |
uses: ./.github/workflows/--rebase-prs.yml | |
secrets: inherit |