-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from ScrewTSW/main
Add release pipeline (updated from @hel0t)
- Loading branch information
Showing
1 changed file
with
101 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.x | ||
|
||
- name: Install dependencies | ||
run: dotnet restore | ||
|
||
- name: Publish application | ||
run: | | ||
if [ ${{ matrix.os }} == "ubuntu-latest" ]; then | ||
echo "PUBLISHING FOR LINUX" | ||
dotnet publish -c Release -r linux-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained true | ||
else | ||
echo "PUBLISHING FOR WINDOWS" | ||
dotnet publish -c Release -r win-x64 /p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true --self-contained true | ||
fi | ||
- name: Create ZIP file | ||
run: | | ||
if [ ${{ matrix.os }} == "ubuntu-latest" ]; then | ||
zip -r --junk-paths FikaServerTools_${{ github.ref_name }}-linux64.zip ./bin/Release/net8.0/linux-x64/publish/ | ||
else | ||
zip -r --junk-paths FikaServerTools_${{ github.ref_name }}-windows64.zip ./bin/Release/net8.0/win-x64/publish/ | ||
fi | ||
shell: bash | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: FikaServerTools_${{ matrix.os }}_${{ github.ref_name }} | ||
path: FikaServerTools_${{ github.ref_name }}-*.zip | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download artifacts (Linux) | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: FikaServerTools_ubuntu-latest_${{ github.ref_name }} | ||
path: ./dist/linux | ||
- name: Download artifacts (Windows) | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: FikaServerTools_windows-latest_${{ github.ref_name }} | ||
path: ./dist/windows | ||
|
||
- name: Create release | ||
id: create_release | ||
uses: Rohit-Kuinkel/create-release-node-update@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref_name }} | ||
release_name: "Fika-ServerTools ${{ github.ref_name }}" | ||
prerelease: true | ||
|
||
- name: Upload Linux build | ||
uses: Rohit-Kuinkel/upload-release-asset-node-update@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./dist/linux/FikaServerTools_${{ github.ref_name }}-linux64.zip | ||
asset_name: FikaServerTools_${{ github.ref_name }}-linux64.zip | ||
asset_content_type: application/zip | ||
|
||
- name: Upload Windows build | ||
uses: Rohit-Kuinkel/upload-release-asset-node-update@main | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./dist/windows/FikaServerTools_${{ github.ref_name }}-windows64.zip | ||
asset_name: FikaServerTools_${{ github.ref_name }}-windows64.zip | ||
asset_content_type: application/zip |