Automatic releases? #1
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | ||
name: publish | ||
on: | ||
push: | ||
branches: | ||
- master # Run the workflow when pushing to the master branch | ||
tags: | ||
- v** # Only when a v... tag is pushed | ||
# Sets permissions of the GITHUB_TOKEN to allow reading packages and push releases | ||
permissions: | ||
packages: read | ||
env: | ||
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | ||
DOTNET_NOLOGO: true | ||
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
NuGetDirectory: ${{ github.workspace}}/nuget | ||
defaults: | ||
run: | ||
shell: pwsh | ||
jobs: | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
Check failure on line 28 in .github/workflows/publish.yml GitHub Actions / publishInvalid workflow file
|
||
release: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
needs: [ build ] | ||
steps: | ||
- name: Download NuGet Packages Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: nuget | ||
path: ${{ env.NuGetDirectory }} | ||
- name: Build Changelog | ||
id: build_changelog | ||
uses: mikepenz/release-changelog-builder-action@v4 | ||
#env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Create Release | ||
uses: mikepenz/action-gh-release@v1 #softprops/action-gh-release | ||
with: | ||
body: ${{steps.build_changelog.outputs.changelog}} | ||
files: ${{ env.NuGetDirectory }}/*.nupkg | ||
fail_on_unmatched_files: true | ||
fail_on_asset_upload_issue: true | ||
prerelease: ${{ contains(github.ref, '-') }} # simple check for vX.Y.Z-something | ||
publish_github: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-latest | ||
needs: [ build ] | ||
steps: | ||
- name: Download NuGet Packages Artifact | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: nuget | ||
path: ${{ env.NuGetDirectory }} | ||
- name: Setup Dotnet | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
source-url: https://nuget.pkg.github.com/MonkeyModdingTroop/index.json | ||
# Publish all NuGet packages to the GitHub feed | ||
# Use --skip-duplicate to prevent errors if a package with the same version already exists. | ||
# If you retry a failed workflow, already published packages will be skipped without error. | ||
- name: Publish NuGet Packages | ||
run: | | ||
foreach($file in (Get-ChildItem "${{ env.NuGetDirectory }}" -Recurse -Include *.nupkg)) { | ||
dotnet nuget push $file --api-key "${{ secrets.NUGET_APIKEY }}" --source https://nuget.pkg.github.com/MonkeyModdingTroop/index.json --skip-duplicate | ||
} |