Cleanup pipelines

This commit is contained in:
2026-02-12 11:25:00 +01:00
parent 9d9c533df7
commit e873b0da6f
9 changed files with 157 additions and 45 deletions
+4 -5
View File
@@ -3,17 +3,16 @@
name: Daybreak Dry-Run CD Pipeline
on:
push:
pull_request:
branches:
- master
paths:
- "Daybreak/**"
- "Daybreak.Core/**"
- "Daybreak.Installer/**"
- "Daybreak.API/**"
- "Daybreak.7ZipExtractor/**"
- "Daybreak.Installer/**"
- "Daybreak.Shared/**"
workflow_dispatch:
- "Daybreak.Windows/**"
- "Daybreak.Linux/**"
jobs:
cd:
+20 -26
View File
@@ -18,6 +18,9 @@ jobs:
build-x86:
runs-on: windows-latest
outputs:
version: ${{ steps.get_version.outputs.version }}
env:
Configuration: Release
Actions_Allow_Unsecure_Commands: true
@@ -29,6 +32,13 @@ jobs:
fetch-depth: 0
submodules: recursive
- name: Get version
id: get_version
shell: pwsh
run: |
$version = (Select-String -Path Directory.Build.props -Pattern '<Version>(.*)</Version>').Matches.Groups[1].Value
echo "version=$version" >> $env:GITHUB_OUTPUT
- name: Install .NET
uses: actions/setup-dotnet@v5
with:
@@ -149,24 +159,14 @@ jobs:
# Stage 3 — Package (always)
# ───────────────────────────────────────────────────────
package:
needs: [build-windows, build-linux]
needs: [build-x86, build-windows, build-linux]
runs-on: ubuntu-latest
env:
Actions_Allow_Unsecure_Commands: true
Version: ${{ needs.build-x86.outputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
submodules: recursive
- name: Set version variable
run: |
version=$(grep '<Version>' Directory.Build.props | sed 's/.*<Version>\(.*\)<\/Version>.*/\1/')
echo "Version=$version" >> $GITHUB_ENV
# ── Windows package ──
- name: Download Windows build
uses: actions/download-artifact@v7
@@ -218,12 +218,13 @@ jobs:
# Stage 4 — Release (optional)
# ───────────────────────────────────────────────────────
release:
needs: package
needs: [build-x86, package]
runs-on: ubuntu-latest
if: ${{ inputs.publishRelease }}
env:
Actions_Allow_Unsecure_Commands: true
Version: ${{ needs.build-x86.outputs.version }}
steps:
- name: Checkout
@@ -243,17 +244,12 @@ jobs:
uses: WyriHaximus/github-action-get-previous-tag@v2
- name: Generate changelog
id: gen_changelog
id: changelog
run: |
changeLog=$(git log --no-merges --pretty="%h - %s (%an)<br />" ${{ steps.getLatestTag.outputs.tag }}..HEAD)
echo "Changelog<<EOF" >> $GITHUB_ENV
echo "$changeLog" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Set version variable
run: |
version=$(grep '<Version>' Directory.Build.props | sed 's/.*<Version>\(.*\)<\/Version>.*/\1/')
echo "Version=$version" >> $GITHUB_ENV
echo "content<<EOF" >> $GITHUB_OUTPUT
echo "$changeLog" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# ── Release ──
- name: Create release draft
@@ -263,13 +259,11 @@ jobs:
tag_name: v${{ env.Version }}
release_name: Daybreak v${{ env.Version }}
assets: release-assets/daybreakv${{ env.Version }}.zip;release-assets/daybreakv${{ env.Version }}-linux.zip
github_token: ${{ env.GITHUB_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
replace_assets: true
body_mrkdwn: |
${{ env.Changelog }}
${{ steps.changelog.outputs.content }}
isDraft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish release
run: gh release edit v${{ env.Version }} --draft=false
+3 -3
View File
@@ -9,12 +9,12 @@ on:
branches:
- master
paths:
- "Daybreak/**"
- "Daybreak.Core/**"
- "Daybreak.Installer/**"
- "Daybreak.API/**"
- "Daybreak.7ZipExtractor/**"
- "Daybreak.Installer/**"
- "Daybreak.Shared/**"
- "Daybreak.Windows/**"
- "Daybreak.Linux/**"
workflow_dispatch:
jobs:
@@ -0,0 +1,12 @@
# Manually trigger to create a new release branch with bumped build version
name: Create Build Release Branch
on:
workflow_dispatch:
jobs:
create-release:
uses: ./.github/workflows/create-release-branch-template.yml
with:
versionBump: bump-build
secrets: inherit
@@ -0,0 +1,12 @@
# Manually trigger to create a new release branch with bumped major version
name: Create Major Release Branch
on:
workflow_dispatch:
jobs:
create-release:
uses: ./.github/workflows/create-release-branch-template.yml
with:
versionBump: bump-major
secrets: inherit
@@ -0,0 +1,12 @@
# Manually trigger to create a new release branch with bumped minor version
name: Create Minor Release Branch
on:
workflow_dispatch:
jobs:
create-release:
uses: ./.github/workflows/create-release-branch-template.yml
with:
versionBump: bump-minor
secrets: inherit
@@ -0,0 +1,66 @@
# Reusable template for creating release branches with version bumps
name: Create Release Branch Template
on:
workflow_call:
inputs:
versionBump:
description: "Version bump command: bump-major, bump-minor, bump-build, bump-revision"
required: true
type: string
jobs:
create-release-branch:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Bump version in Directory.Build.props
id: bump
uses: vers-one/dotnet-project-version-updater@v1.7
with:
file: "Directory.Build.props"
version: ${{ inputs.versionBump }}
- name: Check if release branch already exists
id: check_branch
run: |
branch_name="release/${{ steps.bump.outputs.newVersion }}"
if git ls-remote --heads origin "$branch_name" | grep -q "$branch_name"; then
echo "Branch $branch_name already exists"
echo "exists=true" >> $GITHUB_OUTPUT
else
echo "Branch $branch_name does not exist"
echo "exists=false" >> $GITHUB_OUTPUT
fi
- name: Create release branch
if: steps.check_branch.outputs.exists == 'false'
run: |
new_version="${{ steps.bump.outputs.newVersion }}"
branch_name="release/$new_version"
# Create new branch from master
git checkout -b "$branch_name"
# Commit the version change (already updated by the action)
git add Directory.Build.props
git commit -m "Bump version to $new_version"
# Push the new branch
git push origin "$branch_name"
echo "✅ Created release branch: $branch_name with version $new_version"
@@ -0,0 +1,20 @@
# Automatically creates a new release branch with bumped revision
# after a successful CD pipeline run on master
name: Create Revision Release Branch
on:
workflow_run:
workflows: ["Daybreak CD Pipeline"]
types:
- completed
branches:
- master
jobs:
create-release:
# Only run if the CD pipeline succeeded
if: ${{ github.event.workflow_run.conclusion == 'success' }}
uses: ./.github/workflows/create-release-branch-template.yml
with:
versionBump: bump-revision
secrets: inherit
+8 -11
View File
@@ -5,13 +5,12 @@ on:
branches:
- master
paths:
- "Daybreak/**"
- "Daybreak.Core/**"
- "Daybreak.Installer/**"
- "Daybreak.Linux/**"
- "Daybreak.Windows/**"
- "Daybreak.API/**"
- "Daybreak.Shared/**"
- "Daybreak.Injector/**"
- "Daybreak.Windows/**"
- "Daybreak.Linux/**"
jobs:
check_version:
@@ -44,15 +43,13 @@ jobs:
- name: Build Daybreak project
run: dotnet build Daybreak.Linux -c $Configuration --property:SolutionDir=$GITHUB_WORKSPACE
- name: Set version variable
- name: Get version
id: get_version
run: |
version=$(grep '<Version>' Directory.Build.props | sed 's/.*<Version>\(.*\)<\/Version>.*/\1/')
echo "Version=$version" >> $GITHUB_ENV
echo "version=$version" >> $GITHUB_OUTPUT
- name: Check version difference
run: pwsh ./Scripts/CompareVersions.ps1 -currentVersion ${{ env.Version }} -lastVersion ${{ env.LatestReleaseTag }}
env:
LatestReleaseTag: ${{ steps.getLatestTag.outputs.tag }}
shell:
pwsh
run: pwsh ./Scripts/CompareVersions.ps1 -currentVersion ${{ steps.get_version.outputs.version }} -lastVersion ${{ steps.getLatestTag.outputs.tag }}
shell: pwsh