Skip to content

Commit

Permalink
ci: create publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
sout233 authored Nov 24, 2024
1 parent 34eead2 commit b71e567
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Publish

on:
push:
tags:
- 'v*' # 仅当推送带有v前缀的标签时触发

jobs:
build:
runs-on: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup .NET SDK
uses: actions/setup-dotnet@v4
with:
dotnet-version: '8.0.x'

- name: Publish Application
run: dotnet publish -c Release -r win-x64 --self-contained false

- name: Zip Published Files
run: |
$version = "${{ github.ref_name }}"
Compress-Archive -Path bin\Release\net8.0\win-x64\publish\* -DestinationPath "Nalai_v$version_win_x64.zip" -Force
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Nalai-v${{ github.ref_name }}-win-x64
path: Nalai_v${{ github.ref_name }}_win_x64.zip

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: Nalai_v${{ github.ref_name }}_win_x64.zip
asset_name: Nalai_v${{ github.ref_name }}_win_x64.zip
asset_content_type: application/zip

0 comments on commit b71e567

Please sign in to comment.