fixup! feat(ci): implement ability to push to GitHub packages #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to GitHub | |
on: | |
push: | |
branches: | |
- main | |
env: | |
CONFIGURATION: Release | |
jobs: | |
build: | |
# Sets permissions of the GITHUB_TOKEN to allow release creating | |
permissions: | |
contents: write | |
environment: | |
name: nuget | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup necessary dotnet SDKs | |
uses: actions/setup-dotnet@v3 | |
with: | |
global-json-file: global.json | |
dotnet-version: | | |
8.x | |
- name: Add the GitHub source | |
run: dotnet nuget add source --username USERNAME --password ${{secrets.GITHUB_TOKEN}} --store-password-in-clear-text --name "github.com" "https://nuget.pkg.github.com/fsprojects/index.json" | |
- name: Set Build Version | |
run: | | |
$documentName = "src\FSharp.Control.R3\FSharp.Control.R3.fsproj" | |
$File = ( | |
Select-Xml -XPath "/Project/PropertyGroup[@Label='NuGet']/Version" -Path $documentName | |
)[0].Node | |
$version = "$($File.InnerText)-ci-$Env:GITHUB_RUN_ID" | |
$File.InnerText = $version | |
$File.OwnerDocument.Save((Join-Path $PWD.ProviderPath $documentName)) | |
echo "VERSION=$version" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf8 -Append | |
shell: pwsh | |
- name: publish | |
env: | |
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
FAKE_DETAILED_ERRORS: true | |
ENABLE_COVERAGE: false # AltCover doesn't work with Release builds, reports lower coverage than actual | |
run: | | |
chmod +x ./build.sh | |
./build.sh "PublishToGitHub" |