Skip to content

Commit c0a4cd3

Browse files
authored
+ Nuget feeds on GitHub and AppVeyor
Configure Feed as in https://dusted.codes/github-actions-for-dotnet-core-nuget-packages The project feed from AppVeyor can be found at: https://ci.appveyor.com/nuget/fsharpplus
1 parent 1d53098 commit c0a4cd3

File tree

2 files changed

+53
-1
lines changed

2 files changed

+53
-1
lines changed

.github/workflows/dotnetcore.yml

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
name: .NET Core
22

3+
env:
4+
# Stop wasting time caching packages
5+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
6+
# Disable sending usage data to Microsoft
7+
DOTNET_CLI_TELEMETRY_OPTOUT: true
8+
# GitHub Packages Feed settings
9+
GITHUB_FEED: https://nuget.pkg.github.com/fsprojects
10+
GITHUB_USER: fsprojects
11+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
12+
313
on:
414
push:
515
branches: [ master ]
616
pull_request:
717
branches: [ master ]
8-
918
jobs:
1019
build:
1120

@@ -24,6 +33,47 @@ jobs:
2433
- name: Test with dotnet
2534
run: dotnet test build.proj -v n
2635

36+
package:
37+
runs-on: windows-latest
38+
39+
steps:
40+
- uses: actions/checkout@v2
41+
- name: Setup .NET Core
42+
uses: actions/setup-dotnet@v1
43+
with:
44+
dotnet-version: 6.0.201
45+
- name: Restore
46+
run: git submodule update --init --recursive
47+
48+
- name: Extract branch name
49+
shell: bash
50+
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
51+
id: extract_branch
52+
- name: Setup Version Suffix
53+
shell: pwsh
54+
run: |
55+
$buildId = $env:GITHUB_RUN_NUMBER.PadLeft(5, '0');
56+
$versionSuffixPR = "PR${{ github.event.pull_request.number }}-$buildId";
57+
$branchName = "${{ steps.extract_branch.outputs.branch }}".Replace("_","").Replace("/","-");
58+
$versionSuffixBRANCH = "$($branchName)-CI$($buildId)"
59+
$env:VersionSuffix = if ("${{ github.event.pull_request.number }}") { $versionSuffixPR } else { $versionSuffixBRANCH }
60+
Write-Output "##[set-output name=version_suffix]$($env:VersionSuffix)"
61+
id: version_suffix
62+
- name: Package
63+
run: dotnet pack build.proj --version-suffix ${{ steps.version_suffix.outputs.version_suffix }}
64+
- name: Upload Artifacts
65+
uses: actions/upload-artifact@v2
66+
with:
67+
name: nupkg
68+
path: ./bin/nupkg/*.nupkg
69+
- name: Push to GitHub Feed
70+
shell: bash
71+
run: |
72+
for f in ./bin/nupkg/*.nupkg
73+
do
74+
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
75+
done
76+
2777
docs:
2878
runs-on: windows-latest
2979
steps:

appveyor.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ test: off
2222
artifacts:
2323
- path: bin
2424
name: bin
25+
nuget:
26+
project_feed: true

0 commit comments

Comments
 (0)