mirror of
https://github.com/Myxelium/Lunaris2.0.git
synced 2026-04-09 06:09:39 +00:00
126
.github/workflows/dotnet.yml
vendored
126
.github/workflows/dotnet.yml
vendored
@@ -1,89 +1,67 @@
|
|||||||
name: Release
|
name: .NET Core CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches: [ master ]
|
||||||
- master
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
target: [x86_64-pc-windows-gnu, x86_64-unknown-linux-gnu]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Set up Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
|
|
||||||
- name: Install Windows target
|
|
||||||
run: rustup target add x86_64-pc-windows-gnu
|
|
||||||
|
|
||||||
- name: Install MinGW-w64
|
|
||||||
run: sudo apt-get update && sudo apt-get install -y mingw-w64
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: cargo build --release --target ${{ matrix.target }}
|
|
||||||
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: ${{ matrix.target }}-binary
|
|
||||||
path: target/${{ matrix.target }}/release/
|
|
||||||
|
|
||||||
release:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
fetch-depth: 0 # required for github-action-get-previous-tag
|
||||||
|
|
||||||
- name: Get previous tag
|
- name: Setup .NET
|
||||||
id: previoustag
|
uses: actions/setup-dotnet@v1
|
||||||
uses: 'WyriHaximus/github-action-get-previous-tag@v1'
|
with:
|
||||||
env:
|
dotnet-version: '8.0.x'
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Get next minor version
|
- name: Restore dependencies
|
||||||
id: semver
|
run: dotnet restore ./Bot/Lunaris2.csproj
|
||||||
uses: 'WyriHaximus/github-action-next-semvers@v1'
|
|
||||||
with:
|
|
||||||
version: ${{ steps.previoustag.outputs.tag }}
|
|
||||||
|
|
||||||
- name: Create Release
|
- name: Build
|
||||||
id: create_release
|
run: dotnet build ./Bot/Lunaris2.csproj --no-restore -c Release -o ./out
|
||||||
uses: actions/create-release@v1
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
tag_name: ${{ steps.semver.outputs.next_minor }}
|
|
||||||
release_name: Release ${{ steps.semver.outputs.next_minor }}
|
|
||||||
draft: false
|
|
||||||
prerelease: false
|
|
||||||
|
|
||||||
- name: Upload Release Asset (Windows)
|
- name: Publish
|
||||||
uses: actions/upload-release-asset@v1
|
run: dotnet publish ./Bot/Lunaris2.csproj --configuration Release --output ./out
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
with:
|
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
||||||
asset_path: target/x86_64-pc-windows-gnu/release/
|
|
||||||
asset_name: windows-binary.zip
|
|
||||||
asset_content_type: application/zip
|
|
||||||
|
|
||||||
- name: Upload Release Asset (Linux)
|
- name: Zip the build
|
||||||
uses: actions/upload-release-asset@v1
|
run: 7z a -tzip ./out/Lunaris.zip ./out/*
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
- name: Get previous tag
|
||||||
with:
|
id: previoustag
|
||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
uses: 'WyriHaximus/github-action-get-previous-tag@v1'
|
||||||
asset_path: target/x86_64-unknown-linux-gnu/release/
|
env:
|
||||||
asset_name: linux-binary.tar.gz
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
asset_content_type: application/gzip
|
|
||||||
|
- name: Get next minor version
|
||||||
|
id: semver
|
||||||
|
uses: 'WyriHaximus/github-action-next-semvers@v1'
|
||||||
|
with:
|
||||||
|
version: ${{ steps.previoustag.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||||
|
with:
|
||||||
|
tag_name: ${{ steps.semver.outputs.patch }}
|
||||||
|
release_name: Release ${{ steps.semver.outputs.patch }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
- name: Upload Release Asset
|
||||||
|
id: 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: ./out/Lunaris.zip
|
||||||
|
asset_name: Lunaris.zip
|
||||||
|
asset_content_type: application/zip
|
||||||
|
|||||||
Reference in New Issue
Block a user