chore: update global workflows #98
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: CI | |
on: | |
pull_request: | |
branches: [master] | |
types: [opened, synchronize, reopened] | |
push: | |
branches: [master] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
action: | |
environment: | |
${{ github.event_name == 'pull_request' && | |
github.event.pull_request.head.repo.full_name != github.repository && | |
'external' || 'internal' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Release | |
id: setup-release | |
uses: LizardByte/setup-release-action@master # keep this on master, to prevent endless depandabot PRs | |
with: | |
changelog_path: ./tests/data/set${{ matrix.set }}/CHANGELOG.md | |
fail_on_events_api_error: # PRs will fail if this is true | |
${{ github.event_name == 'pull_request' && 'false' || 'true' }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} # can use GITHUB_TOKEN for read-only access | |
- name: Set action variables | |
id: vars | |
run: | | |
if [ "${{ github.event_name }}" == "pull_request" ]; then | |
changelog_branch=pr-changelogs | |
changelog_file=PR-${{ github.event.pull_request.number }}-CHANGELOG.md | |
discussion_category=tests | |
publish_pre_release=true | |
release_tag=pr-${{ github.event.pull_request.number }}-${{ github.run_id }} | |
else | |
changelog_branch=changelog | |
changelog_file=CHANGELOG.md | |
discussion_category=announcements | |
publish_pre_release=${{ steps.setup-release.outputs.publish_pre_release }} | |
release_tag=${{ steps.setup-release.outputs.release_tag }} | |
fi | |
# set outputs | |
echo "changelog_branch=$changelog_branch" >> $GITHUB_OUTPUT | |
echo "changelog_file=$changelog_file" >> $GITHUB_OUTPUT | |
echo "discussion_category=$discussion_category" >> $GITHUB_OUTPUT | |
echo "publish_stable_release=$publish_stable_release" >> $GITHUB_OUTPUT | |
echo "release_tag=$release_tag" >> $GITHUB_OUTPUT | |
- name: Run Action | |
id: action | |
uses: ./ | |
with: | |
allowUpdates: false | |
artifacts: '' | |
body: '' | |
changelogBranch: ${{ steps.vars.outputs.changelog_branch }} | |
changelogFile: ${{ steps.vars.outputs.changelog_file }} | |
discussionCategory: ${{ steps.vars.outputs.discussion_category }} | |
generateReleaseNotes: true | |
name: ${{ steps.vars.outputs.release_tag }} | |
prerelease: ${{ steps.vars.outputs.publish_pre_release == 'true' }} | |
tag: ${{ steps.vars.outputs.release_tag }} | |
token: ${{ secrets.GH_BOT_TOKEN }} | |
- name: Print changelog | |
run: | | |
echo "${{ steps.action.outputs.changelog }}" | |
- name: Sleep | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
run: sleep 60 | |
- name: Delete Release | |
if: ${{ always() && github.event_name == 'pull_request' }} | |
uses: dev-drprasad/delete-tag-and-release@v1.0.1 | |
with: | |
github_token: ${{ secrets.GH_BOT_TOKEN }} | |
tag_name: ${{ steps.vars.outputs.release_tag }} |