mirror of
https://github.com/sebastian-heinz/mhf-server.git
synced 2025-04-03 13:28:30 +08:00
85 lines
3.3 KiB
YAML
85 lines
3.3 KiB
YAML
name: Create Release
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Setup .NET Core
|
|
uses: actions/setup-dotnet@v1
|
|
with:
|
|
dotnet-version: 3.0.100
|
|
|
|
- name: Build Release
|
|
id: build_release
|
|
run: |
|
|
MHF_VERSION_FILE=${{ github.workspace }}/mhf.version
|
|
MHF_VERSION=$(<"$MHF_VERSION_FILE")
|
|
echo ::set-env name=MHF_VERSION::$MHF_VERSION
|
|
echo ::set-env name=MHF_VERSION_E::$(echo ${GITHUB_SHA} | cut -c1-8)
|
|
mkdir ./release
|
|
for MHF_RUNTIME in win-x86 win-x64 linux-x64 osx-x64; do
|
|
# Server
|
|
dotnet publish Mhf.Cli/Mhf.Cli.csproj /p:Version=$MHF_VERSION /p:FromMSBuild=true --runtime $MHF_RUNTIME --configuration Release --output ./publish/$MHF_RUNTIME-$MHF_VERSION/Server
|
|
# ReleaseFiles
|
|
cp -r ./ReleaseFiles/. ./publish/$MHF_RUNTIME-$MHF_VERSION/
|
|
# Pack
|
|
tar cjf ./release/$MHF_RUNTIME-$MHF_VERSION.tar.gz ./publish/$MHF_RUNTIME-$MHF_VERSION
|
|
done
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1.0.0
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: release-${{ env.MHF_VERSION }}-${{ env.MHF_VERSION_E }}
|
|
release_name: Release ${{ env.MHF_VERSION }}-${{ env.MHF_VERSION_E }}
|
|
draft: false
|
|
prerelease: false
|
|
|
|
- name: Upload win-x86 Release Asset
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./release/win-x86-${{ env.MHF_VERSION }}.tar.gz
|
|
asset_name: win-x86-${{ env.MHF_VERSION }}-${{ env.MHF_VERSION_E }}.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload win-x64 Release Asset
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./release/win-x64-${{ env.MHF_VERSION }}.tar.gz
|
|
asset_name: win-x64-${{ env.MHF_VERSION }}-${{ env.MHF_VERSION_E }}.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload linux-x64 Release Asset
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./release/linux-x64-${{ env.MHF_VERSION }}.tar.gz
|
|
asset_name: linux-x64-${{ env.MHF_VERSION }}-${{ env.MHF_VERSION_E }}.tar.gz
|
|
asset_content_type: application/gzip
|
|
|
|
- name: Upload osx-x64 Release Asset
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_path: ./release/osx-x64-${{ env.MHF_VERSION }}.tar.gz
|
|
asset_name: osx-x64-${{ env.MHF_VERSION }}-${{ env.MHF_VERSION_E }}.tar.gz
|
|
asset_content_type: application/gzip |