Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6828095

Browse files
authoredNov 19, 2024··
Merge pull request #372 from open-ephys/update-actions
Point actions to remote workflow
2 parents 66e4af3 + 01e2236 commit 6828095

File tree

2 files changed

+11
-139
lines changed

2 files changed

+11
-139
lines changed
 

‎.github/workflows/build.yml

Lines changed: 11 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,132 +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-
check-semver:
28-
runs-on: ubuntu-latest
29-
if: github.event_name != 'release'
30-
steps:
31-
- name: Checkout current version
32-
uses: actions/checkout@v4
33-
with:
34-
fetch-depth: 0
35-
36-
- name: Find previous release
37-
id: previous-release
38-
env:
39-
GH_TOKEN: ${{ github.token }}
40-
run: |
41-
echo "RELEASE_NAME=$(gh release list -L 1 --json tagName -q .[0].tagName)" >> $GITHUB_OUTPUT
42-
- name: Checkout last release version
43-
uses: actions/checkout@v4
44-
with:
45-
ref: ${{ steps.previous-release.outputs.RELEASE_NAME }}
46-
path: last-release
47-
sparse-checkout: |
48-
Directory.Build.props
49-
sparse-checkout-cone-mode: false
50-
51-
- name: Extract Versions
52-
id: extract-versions
53-
run: |
54-
echo "CURRENT_VERSION=$(cat ./Directory.Build.props | grep -Po '(?<=VersionPrefix>).*(?=</VersionPrefix>)')" >> $GITHUB_OUTPUT
55-
echo "PREVIOUS_VERSION=$(cat ./last-release/Directory.Build.props | grep -Po '(?<=VersionPrefix>).*(?=</VersionPrefix>)')" >> $GITHUB_OUTPUT
56-
- name: Setup Python
57-
uses: actions/setup-python@v5
58-
with:
59-
python-version: "3.10.12"
60-
61-
- name: Install semver
62-
run: python -m pip install semver
63-
64-
- name: Compare Versions
65-
run: .github/workflows/compare_version_numbers.sh
66-
67-
build:
68-
needs: [setup, check-semver]
69-
if: always() && !failure() && !cancelled()
70-
strategy:
71-
fail-fast: false
72-
matrix:
73-
configuration: [debug, release]
74-
os: [ubuntu-latest, windows-latest]
75-
include:
76-
- os: windows-latest
77-
configuration: release
78-
collect-packages: true
79-
runs-on: ${{ matrix.os }}
80-
env:
81-
CiBuildVersionSuffix: ${{ needs.setup.outputs.build-suffix }}
82-
steps:
83-
- name: Checkout
84-
uses: actions/checkout@v4
10+
types: [published] # 3) Generates a package that is a full release package (X.Y.Z) that is published to Github and NuGet automatically
8511

86-
- name: Setup .NET
87-
uses: actions/setup-dotnet@v4
88-
with:
89-
dotnet-version: 8.x
90-
91-
- name: Restore
92-
run: dotnet restore
93-
94-
- name: Build
95-
run: dotnet build --no-restore --configuration ${{ matrix.configuration }}
96-
97-
- name: Pack
98-
id: pack
99-
if: matrix.collect-packages
100-
run: dotnet pack --no-build --configuration ${{ matrix.configuration }}
101-
102-
- name: Collect packages
103-
uses: actions/upload-artifact@v4
104-
if: matrix.collect-packages && steps.pack.outcome == 'success' && always()
105-
with:
106-
name: Packages
107-
if-no-files-found: error
108-
path: artifacts/package/${{matrix.configuration}}/**
109-
110-
publish-github:
111-
runs-on: ubuntu-latest
112-
permissions:
113-
packages: write
114-
needs: [build]
115-
if: (github.event_name == 'push' || github.event_name == 'release') && always() && !failure() && !cancelled()
116-
steps:
117-
- name: Setup .NET
118-
uses: actions/setup-dotnet@v4
119-
with:
120-
dotnet-version: 8.x
121-
122-
- name: Download packages
123-
uses: actions/download-artifact@v4
124-
with:
125-
name: Packages
126-
path: Packages
127-
128-
- name: Push to GitHub Packages
129-
run: dotnet nuget push "Packages/*.nupkg" --skip-duplicate --no-symbols --api-key ${{secrets.GITHUB_TOKEN}} --source https://nuget.pkg.github.com/${{github.repository_owner}}
130-
env:
131-
# This is a workaround for https://github.com/NuGet/Home/issues/9775
132-
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 }}

‎.github/workflows/compare_version_numbers.sh

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)
Please sign in to comment.