Skip to content

Commit

Permalink
Create publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
ghost1372 committed Aug 12, 2023
1 parent 9df7d30 commit 8a57455
Showing 1 changed file with 93 additions and 0 deletions.
93 changes: 93 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
name: Publish Release

on:
workflow_dispatch:

env:
PROJECT_PATH: dev/AlAnvar.csproj
DIR_PATH: publish

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up NuGet
run: |
nuget sources add -name MyNuGetSource -source https://pkgs.dev.azure.com/dotnet/CommunityToolkit/_packaging/CommunityToolkit-Labs/nuget/v3/index.json
- name: Get TvTime Version
uses: kzrnm/[email protected]
id: get-version
with:
proj-path: ${{ env.PROJECT_PATH }}

- name: Build and Publish TvTime
run: dotnet publish ${{ env.PROJECT_PATH }} -c Release -r win10-x64 -p:Platform=x64 --self-contained true -p:PublishSingleFile=false -p:PublishReadyToRun=true -p:PublishTrimmed=false --output publish

- name: Zip Publish Folder
uses: vimtor/[email protected]
with:
files: ${{ env.DIR_PATH }}
recursive: true
dest: publish/TvTime-v${{steps.get-version.outputs.version-prefix}}.zip

- name: Create Github Release
uses: actions/[email protected]
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VersionName: v${{steps.get-version.outputs.version-prefix}}
with:
tag_name: ${{ env.VersionName }}
release_name: ${{ env.VersionName }}

- name: Upload Zip file to Github Release
uses: csexton/release-asset-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: publish/TvTime-v${{steps.get-version.outputs.version-prefix}}.zip
release-url: ${{ steps.create_release.outputs.upload_url }}

changelog:
needs: build
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Get TvTime Version
uses: kzrnm/[email protected]
id: get-version
with:
proj-path: ${{ env.PROJECT_PATH }}

- name: Install auto-changelog Package
run: npm install -g auto-changelog

- name: Generate CHANGELOG.md
run: auto-changelog --commit-limit false --starting-version v${{steps.get-version.outputs.version-prefix}} --ending-version v${{steps.get-version.outputs.version-prefix}} --hide-credit

- name: Get Latest Github Release
id: latest_release
uses: kaliber5/action-get-release@v1
with:
token: ${{ github.token }}
latest: true

- name: Read CHANGELOG.md Content
id: changelog
uses: jaywcjlove/github-action-read-file@main
with:
localfile: CHANGELOG.md

- name: Update Github Release with CHANGELOG.md
uses: kaliber5/action-update-release@v1
with:
token: ${{ github.token }}
id: ${{ steps.latest_release.outputs.id }}
body: ${{ steps.changelog.outputs.content }}

0 comments on commit 8a57455

Please sign in to comment.