chore: finish workflows for consoles
This commit is contained in:
@@ -1 +1,58 @@
|
||||
name: Console Pull Request
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./src
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
paths:
|
||||
- src/AltGen.Console/**
|
||||
- src/AltGen.Console.Tests/**
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
format:
|
||||
name: Run dotnet format
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x.x
|
||||
- name: Format projects
|
||||
run: |
|
||||
dotnet format ./AltGen.Console/AltGen.Console.csproj --verbosity normal
|
||||
dotnet format ./AltGen.Console.Tests/AltGen.Console.Tests.csproj --verbosity normal
|
||||
- name: Commit Changes
|
||||
run: |
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "<>"
|
||||
if [[ $(git status --porcelain) ]]; then
|
||||
git add .
|
||||
git commit -m "chore: format fixes [skip ci]"
|
||||
git fetch origin
|
||||
git pull --rebase origin ${{ github.head_ref }}
|
||||
git push origin HEAD:${{ github.head_ref }}
|
||||
fi
|
||||
build_and_test:
|
||||
name: Run tests
|
||||
needs: format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup .NET
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x.x
|
||||
- name: Restore dependencies
|
||||
run: dotnet restore ./AltGen.Console.Tests/AltGen.Console.Tests.csproj
|
||||
- name: Build project
|
||||
run: dotnet build ./AltGen.Console.Tests/AltGen.Console.Tests.csproj --no-restore
|
||||
- name: Test project
|
||||
run: dotnet test ./AltGen.Console.Tests/AltGen.Console.Tests.csproj
|
||||
|
||||
|
||||
@@ -1 +1,92 @@
|
||||
name: Publish Console
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
paths:
|
||||
- src/AltGen.Console/**
|
||||
- src/AltGen.Console.Tests/**
|
||||
branches:
|
||||
- main
|
||||
jobs:
|
||||
version:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
- name: Setup .NET 9
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x
|
||||
- name: Install versionize
|
||||
run: dotnet tool install --global Versionize
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config --local user.email "65925598+StevanFreeborn@users.noreply.github.com"
|
||||
git config --local user.name "Stevan Freeborn"
|
||||
- name: Run versionize
|
||||
id: versionize
|
||||
run: versionize -i --exit-insignificant-commits --workingDir ./src/AltGen.Console --commit-suffix "[skip ci]"
|
||||
continue-on-error: true
|
||||
- name: Upload changelog
|
||||
if: steps.versionize.outcome == 'success'
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: change-log
|
||||
path: src/BGR.Console/CHANGELOG.md
|
||||
- name: Push changes to GitHub
|
||||
if: steps.versionize.outcome == 'success'
|
||||
uses: ad-m/github-push-action@master
|
||||
with:
|
||||
github_token: ${{ secrets.ACTIONS_PAT }}
|
||||
branch: ${{ github.ref }}
|
||||
tags: true
|
||||
outputs:
|
||||
is_new_version: ${{ steps.versionize.outcome == 'success' }}
|
||||
publish:
|
||||
needs: [version]
|
||||
if: needs.version.outputs.is_new_version == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.ref }}
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
- name: Setup .NET 9
|
||||
uses: actions/setup-dotnet@v4
|
||||
with:
|
||||
dotnet-version: 9.x
|
||||
- name: Build
|
||||
run: dotnet build src
|
||||
- name: Publish for mac-os
|
||||
run: dotnet publish src/AltGen.Console/AltGen.Console.csproj -c Release -r osx-x64 --self-contained -o dist/mac-os -p:AltGenApiUri=${{ secrets.ALTGEN_API_URI }}
|
||||
- name: Publish for linux-os
|
||||
run: dotnet publish src/AltGen.Console/AltGen.Console.csproj -c Release -r linux-x64 --self-contained -o dist/linux-os -p:AltGenApiUri=${{ secrets.ALTGEN_API_URI }}
|
||||
- name: Publish for windows-os
|
||||
run: dotnet publish src/AltGen.Console/AltGen.Console.csproj -c Release -r win-x64 --self-contained -o dist/windows-os -p:AltGenApiUri=${{ secrets.ALTGEN_API_URI }}
|
||||
- name: Get project version
|
||||
uses: kzrnm/get-net-sdk-project-versions-action@v1
|
||||
id: get-version
|
||||
with:
|
||||
proj-path: src/AltGen.Console/AltGen.Console.csproj
|
||||
- name: Download changlog
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
name: change-log
|
||||
path: src/AltGen.Console
|
||||
- name: Create release
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
token: ${{ secrets.ACTIONS_PAT }}
|
||||
name: bgr v${{ steps.get-version.outputs.version }}
|
||||
tag_name: v${{ steps.get-version.outputs.version }}
|
||||
draft: false
|
||||
body_path: src/AltGen.Console/CHANGELOG.md
|
||||
files: |
|
||||
dist/mac-os/AltGen.Console
|
||||
dist/linux-os/AltGen.Console
|
||||
dist/windows-os/AltGen.Console.exe
|
||||
|
||||
@@ -7,6 +7,12 @@
|
||||
appsettings*.json
|
||||
!appsettings.Example.json
|
||||
|
||||
# generated
|
||||
src/AltGen.Console/Generated/**/*
|
||||
|
||||
# dist
|
||||
dist/**/*
|
||||
|
||||
# dotenv files
|
||||
.env
|
||||
|
||||
|
||||
Reference in New Issue
Block a user