diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..9444fbb66 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: .NET Build + +on: + pull_request: # Run build on every pull request that is not to main/dev + branches-ignore: + - main + - dev + workflow_call: + outputs: + version: + value: ${{ jobs.build.outputs.version }} + +jobs: + build: + runs-on: windows-latest + outputs: + version: ${{ steps.set-version.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.2xx # Align with global.json (including roll forward rules) + + - name: Cache Nuget + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: ⚒️ Run GitVersion + run: ./build.ps1 build-server-version + + - name: ⚒️ Run build + run: ./build.ps1 + + - name: ⬆️ Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: output-${{ env.GitVersion_FullSemVer }} + path: output/*.* + compression-level: 0 # no compression + + - id: set-version + name: Set version to output + run: echo "version=${{ env.GitVersion_FullSemVer }}" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 000000000..b57d1957f --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,30 @@ +name: .NET Build and Publish + +on: + push: + branches: ["main", "dev"] # Continuous delivery on every long-lived branch + tags: ["3.*"] # Manual delivery on every 3.x tag + pull_request: + branches: ["main", "dev"] # Releases on every PR that targets main or dev + +jobs: + build: + uses: ./.github/workflows/ci.yml + +# deploy-installers: +# runs-on: ubuntu-latest +# needs: build +# steps: +# - name: 🔫 Trigger Build Installers +# uses: ALEEF02/workflow-dispatch@v3.0.0 +# with: +# workflow: Build Installers +# repo: specklesystems/connector-installers +# token: ${{ secrets.CONNECTORS_GH_TOKEN }} +# inputs: '{ "run_id": "${{ github.run_id }}", "version": "${{ needs.build.outputs.version }}" }' +# ref: main +# wait-for-completion: true +# wait-for-completion-interval: 10s +# wait-for-completion-timeout: 10m +# display-workflow-run-url: true +# display-workflow-run-url-interval: 10s diff --git a/Speckle.Connectors.sln b/Speckle.Connectors.sln index 20fc05526..67915ee02 100644 --- a/Speckle.Connectors.sln +++ b/Speckle.Connectors.sln @@ -74,6 +74,10 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HostApps", "HostApps", "{42826721-9A18-4762-8BA9-F1429DD5C5B1}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{59E8E8F3-4E42-4E92-83B3-B1C2AB901D18}" + ProjectSection(SolutionItems) = preProject + .github\workflows\main.yml = .github\workflows\main.yml + .github\workflows\ci.yml = .github\workflows\ci.yml + EndProjectSection EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution