69 lines
2.1 KiB
YAML
69 lines
2.1 KiB
YAML
name: Build and Publish
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
release:
|
|
types: [published]
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
|
|
jobs:
|
|
build-and-test:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: "10.0.x"
|
|
- name: Quality gate (analyzers + tests + coverlet ≥ 90%)
|
|
run: bash scripts/woodpecker-verify.sh
|
|
- name: Upload coverage
|
|
uses: codecov/codecov-action@v5
|
|
if: github.event_name == 'push' || github.event_name == 'pull_request'
|
|
with:
|
|
directory: ./coverage
|
|
fail_ci_if_error: false
|
|
|
|
publish-nuget:
|
|
needs: [build-and-test]
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
|
|
if: github.event_name == 'release' && github.event.action == 'published' || github.event_name == 'workflow_dispatch'
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-dotnet@v5
|
|
with:
|
|
dotnet-version: "10.0.x"
|
|
- name: Derive version from tag or Directory.Build.props
|
|
id: version
|
|
shell: bash
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "release" ]; then
|
|
echo "version=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_OUTPUT"
|
|
else
|
|
VER=$(grep '<Version>' Directory.Build.props | head -1 | sed 's/.*<Version>\([^<]*\)<\/Version>.*/\1/')
|
|
echo "version=$VER" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Restore and pack
|
|
run: |
|
|
dotnet restore src/Robotico.Nexus.Client/Robotico.Nexus.Client.csproj
|
|
dotnet pack src/Robotico.Nexus.Client/Robotico.Nexus.Client.csproj -c Release --no-restore -p:Version=${{ steps.version.outputs.version }} -o artifacts
|
|
- name: Push to download.robotico.dev
|
|
if: env.PUBLISH_TOKEN != ''
|
|
env:
|
|
PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }}
|
|
run: |
|
|
bash scripts/nuget-push-download.sh ./artifacts
|