Merge pull request #1 from jithatsonei/main #3
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: .NET Build and Release | |
permissions: | |
contents: write | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: mcr.microsoft.com/dotnet/nightly/sdk:7.0 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet publish --configuration Debug | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v2 | |
with: | |
name: net7.0-artifacts | |
path: | | |
bin/Debug/net7.0/publish/WeaponsGiver.deps.json | |
bin/Debug/net7.0/publish/WeaponsGiver.dll | |
bin/Debug/net7.0/publish/WeaponsGiver.pdb | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: net7.0-artifacts | |
path: bin/Debug/net7.0 | |
- name: Create Tag | |
id: tag_version | |
run: | | |
DATE=$(date +'%y.%m.%d-%H%M%S') | |
echo "RELEASE_TAG=$DATE" >> $GITHUB_ENV | |
- name: Determine if Pre-release | |
id: prerelease | |
run: | | |
if [ "${{ github.ref }}" != "refs/heads/main" ]; then | |
echo "IS_PRERELEASE=true" >> $GITHUB_ENV | |
else | |
echo "IS_PRERELEASE=false" >> $GITHUB_ENV | |
fi | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ env.RELEASE_TAG }} | |
files: bin/Debug/net7.0/* | |
prerelease: ${{ env.IS_PRERELEASE }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |