Skip to content

Commit

Permalink
ci: 👷 Add CI for GoDough
Browse files Browse the repository at this point in the history
  • Loading branch information
Hobart2967 committed Aug 23, 2024
1 parent 7fc71ae commit d90f2bd
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 3 deletions.
7 changes: 7 additions & 0 deletions .github/prepare-library.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
VERSION=$1

xmlstarlet edit \
--inplace \
--update "/Project/PropertyGroup/AssemblyVersion" \
--value "$VERSION" \
GoDough.csproj
4 changes: 4 additions & 0 deletions .github/release-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
VERSION=$1

dotnet pack --configuration Release
echo dotnet nuget push GoDough.${VERSION}.nupkg
47 changes: 47 additions & 0 deletions .github/workflows/on_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Build & Release
on: push
permissions:
contents: read
packages: read

jobs:
on_push:
permissions:
contents: write
packages: write
name: On Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.8.1
- name: Setup xmlstarlet
run: sudo apt update && apt install -y xmlstarlet
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.421
- name: Cache npm
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
- name: Build
run: dotnet build --configuration Release
- name: Test
run: dotnet test --configuration Release --no-build
- name: Publish package
run: |
npx \
--package @semantic-release/commit-analyzer \
--package @semantic-release/release-notes-generator \
--package @semantic-release/github \
--package @semantic-release/exec \
--package @semantic-release/git \
semantic-release
if: github.ref_name == 'main'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36 changes: 36 additions & 0 deletions .releaserc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
branches: ['main'],
plugins: [
[
'@semantic-release/commit-analyzer',
{
preset: 'angular',
releaseRules: [
{ type: 'docs', scope: 'README', release: 'patch' },
{ type: 'refactor', release: 'patch' },
{ type: 'style', release: 'patch' },
],
parserOpts: {
noteKeywords: ['BREAKING CHANGE', 'BREAKING CHANGES'],
},
},
],
'@semantic-release/release-notes-generator',
'@semantic-release/github',
[
'@semantic-release/exec',
{
prepareCmd: './.github/prepare-library.sh ${nextRelease.version}',
publishCmd: './.github/release-package.sh ${nextRelease.version}',
},
],
[
'@semantic-release/git',
{
assets: ['GoDough.csproj'],
message:
'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
},
],
],
};
7 changes: 4 additions & 3 deletions GoDough.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0"?>
<Project Sdk="Godot.NET.Sdk/4.0.2">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<EnableDynamicLoading>true</EnableDynamicLoading>
<AssemblyVersion>3.4.5</AssemblyVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.0"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0"/>
</ItemGroup>
</Project>

0 comments on commit d90f2bd

Please sign in to comment.