Fix Makefile #47
Workflow file for this run
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: Release | |
on: | |
push: | |
branches: | |
- main | |
pull_request_target: | |
workflow_dispatch: | |
permissions: | |
contents: write | |
pull-requests: write | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
jobs: | |
draft: | |
name: draft | |
runs-on: ubuntu-latest | |
outputs: | |
tag_name: ${{ steps.release_drafter.outputs.tag_name }} | |
steps: | |
- uses: release-drafter/release-drafter@v6 | |
id: release_drafter | |
with: | |
commitish: main | |
release: | |
name: release | |
environment: release | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' | |
needs: draft | |
env: | |
VERSION: ${{ needs.draft.outputs.tag_name }} | |
steps: | |
- uses: release-drafter/release-drafter@v6 | |
id: release-drafter | |
with: | |
publish: true | |
commitish: main | |
- name: Create semver outputs | |
uses: actions/github-script@v7 | |
id: semver | |
with: | |
script: | | |
const matched = "${{ env.VERSION }}".match(/(((\d+)\.\d+).\d+)/) | |
core.setOutput('major', matched[3]) | |
core.setOutput('minor', matched[2]) | |
core.setOutput('patch', matched[1]) | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ env.VERSION }} | |
- name: Update major tag | |
if: steps.semver.outputs.major != '0' | |
run: | | |
git push -f origin "refs/tags/${VERSION}:refs/tags/${{ steps.semver.outputs.major }}" | |
- name: Update minor tag | |
if: steps.semver.outputs.minor != '0.0' | |
run: | | |
git push -f origin "refs/tags/${VERSION}:refs/tags/${{ steps.semver.outputs.minor }}" | |
- name: Execute dotnet pack | |
run: | | |
dotnet pack ./VContainerAnalyzer/VContainerAnalyzer.csproj \ | |
-c Release \ | |
-p:Version="${VERSION}" \ | |
-p:PackageVersion="${VERSION}" \ | |
-o . | |
- name: Push to NuGet | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: | | |
dotnet nuget push "VContainerAnalyzer.${VERSION}.nupkg" \ | |
-s https://api.nuget.org/v3/index.json \ | |
-k "${NUGET_API_KEY}" |