Last active
May 15, 2024 12:06
-
-
Save ghost1372/5d663dd0b38598ed8e89490c395a952d to your computer and use it in GitHub Desktop.
I use this action to publish project, compress to Zip and upload to GitHub release
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: "Publish" | |
on: | |
push: | |
tags: | |
- "v*" | |
env: | |
PROJECT_PATH: WpfApp6/WpfApp6.csproj | |
ZIP_PATH: WpfApp6/bin/Release/net5.0-windows/win-x86/publish/WpfApp6-Portable.zip | |
EXE_PATH: WpfApp6/bin/Release/net5.0-windows/win-x86/publish/WpfApp6.exe | |
jobs: | |
deploy: | |
runs-on: windows-latest | |
steps: | |
- name: Initialize Actions | |
uses: actions/checkout@v2 | |
- name: Initialize .Net | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 5.0.x | |
- name: Restore Project | |
run: dotnet restore ${{ env.PROJECT_PATH }} | |
- name: Publish Project | |
run: dotnet publish ${{ env.PROJECT_PATH }} -c Release --self-contained -r win-x86 -p:PublishSingleFile=true --no-restore | |
- name: Create Zip File | |
uses: papeloto/action-zip@v1 | |
with: | |
files: ${{ env.EXE_PATH }} | |
dest: ${{ env.ZIP_PATH }} | |
- name: Initialize Release | |
uses: actions/create-release@v1 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
- name: Create Release | |
uses: csexton/release-asset-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.ZIP_PATH }} | |
release-url: ${{ steps.create_release.outputs.upload_url }} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment