Skip to content

Commit 34c9efb

Browse files
committed
feature: Add CI
1 parent fb4f79d commit 34c9efb

7 files changed

Lines changed: 180 additions & 2 deletions

File tree

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Update Data Model and Template
2+
3+
on:
4+
workflow_dispatch:
5+
repository_dispatch:
6+
types: [OpenActive.NET-update,data-models-update,dataset-site-template-update]
7+
8+
jobs:
9+
generate:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout OpenActive.DatasetSite.NET
14+
uses: actions/checkout@v2
15+
with:
16+
ref: master
17+
18+
- name: Setup Node.js 14.x
19+
uses: actions/setup-node@v1
20+
with:
21+
node-version: 14.x
22+
23+
- name: Setup .NET Core 3.1.x
24+
uses: actions/setup-dotnet@v1
25+
with:
26+
dotnet-version: 3.1.x
27+
28+
- name: Install OpenActive.DatasetSite.NET.Generator
29+
run: npm install
30+
working-directory: ./OpenActive.DatasetSite.NET.Generator/
31+
32+
- name: Update OpenActive.DatasetSite.NET.Generator with latest data-models and dataset-site-template
33+
run: npm update @openactive/data-models @opoenactive/dataset-site-template
34+
working-directory: ./OpenActive.DatasetSite.NET.Generator/
35+
36+
- name: Run .NET dataset site generator
37+
run: npm start
38+
working-directory: ./OpenActive.DatasetSite.NET.Generator/
39+
40+
- name: Update OpenActive.NET to latest version
41+
run: dotnet add package OpenActive.NET
42+
working-directory: ./OpenActive.DatasetSite.NET/
43+
44+
- name: Create Pull Request
45+
id: cpr
46+
uses: peter-evans/create-pull-request@v3
47+
with:
48+
path: .
49+
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
50+
commit-message: Update data models and dataset site template
51+
committer: openactive-bot <openactive-bot@users.noreply.github.com>
52+
author: openactive-bot <openactive-bot@users.noreply.github.com>
53+
signoff: false
54+
branch: ci/update-data-models
55+
delete-branch: true
56+
title: 'Update data models and dataset site template'
57+
body: |
58+
Update to use latest version of data models based on the [OpenActive Vocabulary](https://openactive.io/ns/) (codified by the [Data Models](https://github.com/openactive/data-models)), and the latest version of the [Dataset Site Template](https://github.com/openactive/dataset-site-template)
59+
labels: |
60+
automated pr
61+
team-reviewers: |
62+
owners
63+
maintainers
64+
draft: false
65+
66+
- name: Check outputs
67+
run: |
68+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
69+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Tested and Published on NuGet
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout OpenActive.DatasetSite.NET
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
16+
17+
- name: Get current version
18+
uses: dotnet/nbgv@master
19+
id: nbgv
20+
21+
- name: Setup .NET Core 3.1.x
22+
uses: actions/setup-dotnet@v1
23+
with:
24+
dotnet-version: 3.1.x
25+
26+
- name: Install dependencies
27+
run: dotnet restore
28+
29+
- name: Test
30+
run: dotnet test ./OpenActive.DatasetSite.NET.Tests/OpenActive.DatasetSite.NET.Tests.csproj --configuration Release --no-restore --verbosity normal
31+
32+
- name: Build
33+
run: dotnet build ./OpenActive.DatasetSite.NET/OpenActive.DatasetSite.NET.csproj --configuration Release --no-restore
34+
35+
- name: Pack
36+
run: dotnet pack ./OpenActive.DatasetSite.NET/OpenActive.DatasetSite.NET.csproj --configuration Release --include-source --no-build -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg
37+
38+
- name: Push to Nuget
39+
if: "! contains(toJSON(github.event.commits.*.message), '[no-release]')"
40+
run: dotnet nuget push "./OpenActive.DatasetSite.NET/**/*.nupkg" -k ${{secrets.NUGET_API_KEY}} --skip-duplicate -s https://api.nuget.org/v3/index.json
41+
42+
- name: Create Release
43+
if: "! contains(toJSON(github.event.commits.*.message), '[no-release]')"
44+
id: create_release
45+
uses: actions/create-release@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: v${{ steps.nbgv.outputs.SimpleVersion }}
50+
release_name: Release ${{ steps.nbgv.outputs.SimpleVersion }}
51+
body: |
52+
This release contains minor amendments based on updates to the [OpenActive Vocabulary](https://openactive.io/ns/) (codified by the [Data Models](https://github.com/openactive/data-models)), and the latest version of the [Dataset Site Template](https://github.com/openactive/dataset-site-template).
53+
54+
Published to [Nuget](https://www.nuget.org/packages/OpenActive.DatasetSite.NET/${{ steps.nbgv.outputs.SimpleVersion }}).
55+
draft: false
56+
prerelease: false

.github/workflows/tests.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Tests
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout OpenActive.DatasetSite.NET
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
16+
- name: Setup .NET Core 3.1.x
17+
uses: actions/setup-dotnet@v1
18+
with:
19+
dotnet-version: 3.1.x
20+
- name: Install dependencies
21+
run: dotnet restore
22+
- name: Build
23+
run: dotnet build ./OpenActive.DatasetSite.NET.Tests/OpenActive.DatasetSite.NET.Tests.csproj --no-restore --configuration Release
24+
- name: Test
25+
run: dotnet test ./OpenActive.DatasetSite.NET.Tests/OpenActive.DatasetSite.NET.Tests.csproj --configuration Release --no-restore --no-build --verbosity normal

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,3 +328,5 @@ ASALocalRun/
328328

329329
# MFractors (Xamarin productivity tool) working folder
330330
.mfractor/
331+
332+
.DS_Store

Directory.Build.props

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<ItemGroup>
4+
<PackageReference Include="Nerdbank.GitVersioning">
5+
<Version>3.3.37</Version>
6+
<PrivateAssets>all</PrivateAssets>
7+
</PackageReference>
8+
</ItemGroup>
9+
</Project>

OpenActive.DatasetSite.NET/OpenActive.DatasetSite.NET.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
4+
<TargetFramework>netstandard2.0</TargetFramework>
55
<Authors>OpenActive Community</Authors>
66
<Company>OpenActive</Company>
77
<Copyright>OpenActive</Copyright>
@@ -20,7 +20,7 @@
2020
<DefineConstants>TRACE</DefineConstants>
2121
<DebugType>portable</DebugType>
2222
<DebugSymbols>true</DebugSymbols>
23-
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\OpenActive.NET.xml</DocumentationFile>
23+
<DocumentationFile>bin\$(Configuration)\$(TargetFramework)\OpenActive.DatasetSite.NET.xml</DocumentationFile>
2424
<OutputPath></OutputPath>
2525
</PropertyGroup>
2626

@@ -32,6 +32,10 @@
3232
<PackageReference Include="OpenActive.NET" Version="15.2.2" />
3333
<PackageReference Include="Stubble.Core" Version="1.7.2" />
3434
<PackageReference Include="Stubble.Extensions.JsonNet.Net45" Version="1.3.3" />
35+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37">
36+
<PrivateAssets>all</PrivateAssets>
37+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
38+
</PackageReference>
3539
</ItemGroup>
3640

3741
</Project>

version.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
3+
"version": "4.2",
4+
"publicReleaseRefSpec": [
5+
"^refs/heads/master$"
6+
],
7+
"cloudBuild": {
8+
"setVersionVariables": true,
9+
"buildNumber": {
10+
"enabled": true
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)