Skip to content

Commit

Permalink
+ Nuget feeds on GitHub and AppVeyor
Browse files Browse the repository at this point in the history
  • Loading branch information
wallymathieu committed Jul 21, 2022
1 parent 1d53098 commit c0a4cd3
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
52 changes: 51 additions & 1 deletion .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
name: .NET Core

env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/fsprojects
GITHUB_USER: fsprojects
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

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

package:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.201
- name: Restore
run: git submodule update --init --recursive

- name: Extract branch name
shell: bash
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})"
id: extract_branch
- name: Setup Version Suffix
shell: pwsh
run: |
$buildId = $env:GITHUB_RUN_NUMBER.PadLeft(5, '0');
$versionSuffixPR = "PR${{ github.event.pull_request.number }}-$buildId";
$branchName = "${{ steps.extract_branch.outputs.branch }}".Replace("_","").Replace("/","-");
$versionSuffixBRANCH = "$($branchName)-CI$($buildId)"
$env:VersionSuffix = if ("${{ github.event.pull_request.number }}") { $versionSuffixPR } else { $versionSuffixBRANCH }
Write-Output "##[set-output name=version_suffix]$($env:VersionSuffix)"
id: version_suffix
- name: Package
run: dotnet pack build.proj --version-suffix ${{ steps.version_suffix.outputs.version_suffix }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
with:
name: nupkg
path: ./bin/nupkg/*.nupkg
- name: Push to GitHub Feed
shell: bash
run: |
for f in ./bin/nupkg/*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$f $GITHUB_FEED
done
docs:
runs-on: windows-latest
steps:
Expand Down
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ test: off
artifacts:
- path: bin
name: bin
nuget:
project_feed: true

0 comments on commit c0a4cd3

Please sign in to comment.