Skip to content
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
45 changes: 45 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# The source skeleton for this configuration can be found at
# https://github.com/BesLogic/shared-configs/blob/main/.editorconfig
# Modifications to this file that are not project-specific should also be done upstream.

# Editor configuration, see https://editorconfig.org
root = true

[*]
#### Widely Supported by Editors ####
#### https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#widely-supported-by-editors

indent_style = space
indent_size = 2
# tab_width defaults indent_size when indent_size is a number, but VS will add it back
tab_width = 2
# TODO: Change back in a formatting pass
end_of_line = crlf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

#### Supported By A Limited Number of Editors ####
#### https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#supported-by-a-limited-number-of-editors

max_line_length = 100

#### Ideas for Domain-Specific Properties ####
#### https://github.com/editorconfig/editorconfig/wiki/EditorConfig-Properties#ideas-for-domain-specific-properties

quote_type = auto

#### EditorGuidelines ####
#### https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelinesPreview#editorconfig-support-vs-2017-and-above
guidelines = 80, 100

#### Language-specific overrides ####

[*.cs]
indent_size = 4
# tab_width defaults indent_size when indent_size is a number, but VS will add it back
tab_width = 4

[*.{md,patch,diff}]
max_line_length = off
trim_trailing_whitespace = false
20 changes: 0 additions & 20 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,22 +1,2 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp
*.sln merge=union
*.csproj merge=union
*.vbproj merge=union
*.fsproj merge=union
*.dbproj merge=union

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: CI

# PR / branch validation only. Publishing (and its validation) lives in release.yml.
on:
push:
branches:
- main
pull_request:

permissions:
contents: read

concurrency:
# Cancel previous runs for the same PR
# Don't cancel successive pushes to main
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
build:
# Pinned (not windows-latest) so a runner image bump can't silently drop the
# .NET Framework 4.8.1 targeting pack this build needs.
runs-on: windows-2022

steps:
- uses: actions/checkout@v7

- uses: actions/setup-dotnet@v5
with:
dotnet-version: "10.0.x"

# Debug + implicit restore. -o collects the output in a known, flat path for the upload step.
- run: dotnet build --configuration Debug -o artifacts

- run: dotnet format --verify-no-changes

- uses: actions/upload-artifact@v4
with:
name: LiveSplit.AutoSplitIntegration
path: |
artifacts/LiveSplit.AutoSplitIntegration.dll
artifacts/LiveSplit.AutoSplitIntegration.pdb
if-no-files-found: error
127 changes: 127 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
name: Release

# The `validate` job runs on every PR/push/dispatch (so a manifest that would break the updater
# is caught before merge). The `release` job depends on it and only publishes on a push to main
# that changes the manifest, or a manual workflow_dispatch. The tag is created as part of
# publishing, so a failed run leaves nothing to clean up (just re-run via "Run workflow").
on:
push:
branches:
- main
paths:
- update.LiveSplit.AutoSplitIntegration.xml
pull_request:
branches:
- main
paths:
- update.LiveSplit.AutoSplitIntegration.xml
workflow_dispatch:
inputs:
version:
description: "Version (X.Y.Z) to (re)publish. Leave blank for release entry in the manifest"
required: false
default: ""

permissions:
contents: read

concurrency:
# Cancel previous runs for the same PR
# Don't cancel successive pushes to main
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
validate:
# Only bash + pwsh needed, so the cheaper Linux runner (with real coreutils) is fine.
runs-on: ubuntu-latest
outputs:
version: ${{ steps.ver.outputs.version }}
steps:
- uses: actions/checkout@v7

# Target version = the workflow_dispatch input if given, else the highest non-0.0.0
# <update version> in the manifest (0.0.0 is the unreleased staging block).
- name: Determine target version
id: ver
shell: bash
run: |
xml=update.LiveSplit.AutoSplitIntegration.xml
version="${{ github.event.inputs.version }}"
version="${version#v}" # tolerate a stray leading v; the manifest/build use bare X.Y.Z
if [ -z "$version" ]; then
version=$(grep -oE '<update version="[^"]+"' "$xml" \
| sed -E 's/.*"([^"]+)"/\1/' | grep -v '^0\.0\.0$' | sort -V | tail -1)
fi
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Target release version: ${version:-<none>}"

# Fails on any manifest shape that would break the updater's parse, and (with a target
# version) that its release entry is complete. Also fails a manifest with no releasable
# entry, so an empty version can never reach the release job.
- name: Validate manifest
shell: pwsh
run: ./scripts/validate-manifest.ps1 -ReleaseVersion "${{ steps.ver.outputs.version }}"

release:
needs: validate
# PRs validate only; publishing happens on push-to-main and manual dispatch.
if: github.event_name != 'pull_request'
# Pinned windows runner for the .NET Framework 4.8.1 targeting pack (see ci.yml).
runs-on: windows-2022
permissions:
contents: write
env:
VERSION: ${{ needs.validate.outputs.version }}
steps:
- uses: actions/checkout@v7

# On a push, skip if the release already exists (unrelated manifest edits, e.g. adding to
# the 0.0.0 block, must not republish). workflow_dispatch skips this check and always
# (re)publishes, so a failed release can be retried.
- name: Check existing release
id: exists
if: github.event_name == 'push'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
run: |
if gh release view "v$VERSION" >/dev/null 2>&1; then
echo "already=true" >> "$GITHUB_OUTPUT"
echo "Release v$VERSION already exists; nothing to publish."
else
echo "already=false" >> "$GITHUB_OUTPUT"
fi

- uses: actions/setup-dotnet@v5
if: steps.exists.outputs.already != 'true'
with:
dotnet-version: "10.0.x"

# Release build with implicit restore.
- run: dotnet build --configuration Release -o artifacts -p:Version=$env:VERSION
if: steps.exists.outputs.already != 'true'

- name: Release notes from manifest
if: steps.exists.outputs.already != 'true'
shell: pwsh
run: |
[xml]$doc = Get-Content -Raw -LiteralPath 'update.LiveSplit.AutoSplitIntegration.xml'
$u = $doc.SelectSingleNode("/updates/update[@version='$env:VERSION']")
$lines = @($u.SelectNodes('changelog/change') | ForEach-Object { '- ' + $_.InnerText.Trim() })
Set-Content -Path release-notes.md -Value $lines -Encoding utf8
Get-Content release-notes.md

# Creates the tag v<version> at this commit and the release together, so nothing is left
# dangling on failure. make_latest (default) promotes it to the "latest" release.
- uses: softprops/action-gh-release@v3
if: steps.exists.outputs.already != 'true'
with:
tag_name: v${{ needs.validate.outputs.version }}
target_commitish: ${{ github.sha }}
name: v${{ needs.validate.outputs.version }}
body_path: release-notes.md
files: |
artifacts/LiveSplit.AutoSplitIntegration.dll
artifacts/LiveSplit.AutoSplitIntegration.pdb
fail_on_unmatched_files: true
Loading
Loading