Minor Refactoring #18
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 Release" | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- closed | |
jobs: | |
release: | |
name: Publish New Release | |
runs-on: ubuntu-latest | |
if: github.event.pull_request.merged == true && | |
(startsWith(github.event.pull_request.head.ref, 'release/') || startsWith(github.event.pull_request.head.ref, 'hotfix/')) | |
steps: | |
- name: Extract version from branch name (for release branches) | |
if: startsWith(github.event.pull_request.head.ref, 'release/') | |
run: | | |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | |
VERSION=${BRANCH_NAME#release/} | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
- name: Extract version from branch name (for hotfix branches) | |
if: startsWith(github.event.pull_request.head.ref, 'hotfix/') | |
run: | | |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | |
VERSION=${BRANCH_NAME#hotfix/} | |
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV | |
# Build & Publish PK3 | |
- uses: actions/checkout@v4 | |
- id: build-suffix | |
env: | |
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | |
shell: bash | |
run: echo "SUFFIX=${{ env.RELEASE_VERSION }}" >> "$GITHUB_OUTPUT" | |
- uses: ./.github/workflows/build-pk3 | |
env: | |
SUFFIX: ${{ steps.build-suffix.outputs.SUFFIX }} | |
# Create Release | |
- uses: softprops/action-gh-release@v0.1.15 | |
env: | |
RELEASE_VERSION: ${{ env.RELEASE_VERSION }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
target_commitish: ${{ github.event.pull_request.merge_commit_sha }} | |
tag_name: ${{ env.RELEASE_VERSION }} | |
name: ${{ env.RELEASE_VERSION }} | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
files: ./*.pk3 |