Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Build Scripts #35

Merged
merged 1 commit into from
Feb 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/draft-new-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: 'Draft New Release'

on:
workflow_dispatch:
inputs:
version:
description: 'The version you want to release.'
required: true

jobs:
draft-new-release:
name: 'Draft a New Release'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Create release branch
run: git checkout -b release/${{ github.event.inputs.version }}

- name: Update Changelog
uses: thomaseizinger/[email protected]
with:
version: ${{ github.event.inputs.version }}

- name: Initialize mandatory git config
run: |
git config user.name "Github Actions"
git config user.email "[email protected]"

- name: Commit Changelog
id: make-commit
run: |
git add CHANGELOG.md
git commit --message "Prepare release ${{ github.event.inputs.version }}"

echo "::set-output name=commit::$(git rev-parse HEAD)"

- name: Push New Branch
run: git push origin release/${{ github.event.inputs.version }}

- name: Create Pull Request
uses: thomaseizinger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
head: release/${{ github.event.inputs.version }}
base: main
title: Release ${{ github.event.inputs.version }}
reviewers: ${{ github.actor }}
body: |
Hi @${{ github.actor }}!

This PR was created in response to a manual trigger of the release workflow here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}.
I've updated the changelog file in this commit: ${{ steps.make-commit.outputs.commit }}.

Merging this PR will create a GitHub release with the new PK3.
43 changes: 37 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,54 @@
name: Release PK3s
name: "Publish New Release"

on:
push:
tags:
- "v*.*.*"
pull_request:
branches:
- main
types:
- closed

jobs:
buildAndRelease:
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
shell: bash
run: echo "SUFFIX=${{ github.ref_name }}" >> "$GITHUB_OUTPUT"
- uses: ./.github/workflows/build-pk3
env:
SUFFIX: ${{ steps.build-suffix.outputs.SUFFIX }}
- uses: softprops/[email protected]
- uses: softprops/[email protected]
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
discussion_category_name: 'Releases'
files: ./*.pk3