Skip to content

Commit 307449e

Browse files
authored
Merge pull request #13 from open-ephys/update-actions
Point actions to remote workflow
2 parents e8ffc14 + edb1fc5 commit 307449e

File tree

2 files changed

+12
-87
lines changed

2 files changed

+12
-87
lines changed

.github/workflows/build.yml

Lines changed: 11 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,16 @@
1-
name: Build
2-
1+
name: Build .NET and Publish to Nuget
2+
3+
# This workflow will run when: 1) any commit is pushed to main, 2) any pull request is opened that will merge to main, and 3) whenever a new release is published.
34
on:
45
push:
5-
branches: [main]
6+
branches: [main] # 1) Generates a package on Github that is a pre-release package, and is typically named X.Y.Z-main-ci000, where X/Y/Z are the semantic version numbers, and ci000 is incremented for each action that is run, guaranteeing a unique package name
67
pull_request:
8+
branches: [main] # 2) Does not generate a package, but does check that the semantic version number is increasing, and that the package builds correctly in all matrix configurations (Ubuntu / Windows and Release / Debug)
79
release:
8-
types: [published]
9-
env:
10-
DOTNET_NOLOGO: true
11-
DOTNET_CLI_TELEMETRY_OPTOUT: true
12-
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
13-
ContinuousIntegrationBuild: true
14-
CiRunNumber: ${{ github.run_number }}
15-
CiRunPushSuffix: ${{ github.ref_name }}-ci${{ github.run_number }}
16-
CiRunPullSuffix: pull-${{ github.event.number }}-ci${{ github.run_number }}
17-
jobs:
18-
setup:
19-
runs-on: ubuntu-latest
20-
outputs:
21-
build-suffix: ${{ steps.setup-build.outputs.build-suffix }}
22-
steps:
23-
- name: Setup Build
24-
id: setup-build
25-
run: echo "build-suffix=${{ github.event_name == 'push' && env.CiRunPushSuffix || github.event_name == 'pull_request' && env.CiRunPullSuffix || null }}" >> "$GITHUB_OUTPUT"
26-
27-
build:
28-
needs: [setup]
29-
strategy:
30-
fail-fast: false
31-
matrix:
32-
configuration: [debug, release]
33-
os: [ubuntu-latest, windows-latest]
34-
include:
35-
- os: windows-latest
36-
configuration: release
37-
collect-packages: true
38-
runs-on: ${{ matrix.os }}
39-
env:
40-
CiBuildVersionSuffix: ${{ needs.setup.outputs.build-suffix }}
41-
steps:
42-
- name: Checkout
43-
uses: actions/checkout@v4
44-
45-
- name: Setup .NET
46-
uses: actions/setup-dotnet@v4
47-
with:
48-
dotnet-version: 8.x
49-
50-
- name: Restore
51-
run: dotnet restore
52-
53-
- name: Build
54-
run: dotnet build --no-restore --configuration ${{ matrix.configuration }}
55-
56-
- name: Pack
57-
id: pack
58-
if: matrix.collect-packages
59-
run: dotnet pack --no-build --configuration ${{ matrix.configuration }}
10+
types: [published] # 3) Generates a package that is a full release package (X.Y.Z) that is published to Github and NuGet automatically
6011

61-
- name: Collect packages
62-
uses: actions/upload-artifact@v4
63-
if: matrix.collect-packages && steps.pack.outcome == 'success' && always()
64-
with:
65-
name: Packages
66-
if-no-files-found: error
67-
path: artifacts/package/${{matrix.configuration}}/**
68-
69-
publish-github:
70-
runs-on: ubuntu-latest
71-
permissions:
72-
packages: write
73-
needs: [build]
74-
if: github.event_name == 'push' || github.event_name == 'release'
75-
steps:
76-
- name: Setup .NET
77-
uses: actions/setup-dotnet@v4
78-
with:
79-
dotnet-version: 8.x
80-
81-
- name: Download packages
82-
uses: actions/download-artifact@v4
83-
with:
84-
name: Packages
85-
path: Packages
86-
87-
- name: Push to GitHub Packages
88-
run: dotnet nuget push "Packages/*.nupkg" --skip-duplicate --no-symbols --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}}
89-
env:
90-
# This is a workaround for https://github.com/NuGet/Home/issues/9775
91-
DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER: 0
12+
jobs:
13+
build_and_publish:
14+
uses: open-ephys/github-actions/.github/workflows/build_dotnet_publish_nuget.yml@main
15+
secrets:
16+
NUGET_APIKEY: ${{ secrets.NUGET_APIKEY }}

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<PackageLicenseFile>LICENSE</PackageLicenseFile>
1414
<UseArtifactsOutput>true</UseArtifactsOutput>
1515
<PackageIcon>icon.png</PackageIcon>
16-
<VersionPrefix>0.2.0</VersionPrefix>
16+
<VersionPrefix>0.2.1</VersionPrefix>
1717
<VersionSuffix></VersionSuffix>
1818
<LangVersion>9.0</LangVersion>
1919
<Features>strict</Features>

0 commit comments

Comments
 (0)