[FEEDS-47]add mod template in token #92
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: | |
pull_request: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
Release: | |
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-') | |
runs-on: ubuntu-latest | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: "true" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
const get_change_log_diff = require('./scripts/get_changelog_diff.js') | |
core.exportVariable('CHANGELOG', get_change_log_diff()) | |
// Getting the release version from the PR source branch | |
// Source branch looks like this: release-1.0.0 | |
const version = context.payload.pull_request.head.ref.split('-')[1] | |
core.exportVariable('VERSION', version) | |
- name: Setup dotnet | |
uses: actions/setup-dotnet@v2 | |
with: | |
dotnet-version: "6.0.x" | |
- name: Create the package | |
run: dotnet pack --configuration Release ./src | |
- name: Publish the package | |
run: dotnet nuget push "./src/bin/Release/*.nupkg" -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate | |
- name: Create release on GitHub | |
uses: ncipollo/release-action@v1 | |
with: | |
body: ${{ env.CHANGELOG }} | |
tag: ${{ env.VERSION }} | |
token: ${{ secrets.GITHUB_TOKEN }} |