Skip to content

Commit

Permalink
Add github actions for build and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
tekgator committed May 28, 2023
1 parent f18e526 commit 65ae351
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/build-and-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: "build-and-publish"

on:
push:
tags:
- "v*"

env:
SOLUTION_PATH: MinecraftJars.sln
PACKAGE_OUTPUT_DIR: ${{ github.workspace }}\output
NUGET_SOURCE_URL: "https://api.nuget.org/v3/index.json"

jobs:
build:
name: "build"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Install dotnet"
uses: actions/setup-dotnet@v2
with:
dotnet-version: "7.0.x"

- name: "Restore packages"
run: dotnet restore ${{ env.SOLUTION_PATH }}

- name: "Build project"
run: dotnet build ${{ env.SOLUTION_PATH }} --no-restore --configuration Release

- name: "Get version"
id: version
uses: battila7/get-version-action@v2

- name: "Pack project"
run: dotnet pack ${{ env.SOLUTION_PATH }} --no-restore --configuration Release --p:PackageVersion=${{ steps.version.outputs.version-without-v }} --output ${{ env.PACKAGE_OUTPUT_DIR }}

- name: "Push package"
run: dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIR }}\*.nupkg --api-key ${{ secrets.NUGET_AUTH_TOKEN }} --source ${{ env.NUGET_SOURCE_URL }}
39 changes: 39 additions & 0 deletions .github/workflows/build-on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: "build-on-push"

on:
push:
branches: [main, dev]
paths-ignore:
- '**.md'
- 'LICENSE'
- 'Resources/**'
pull_request:
branches: [main, dev]
paths-ignore:
- 'README.md'
- 'CHANGELOG.md'
- 'LICENSE'

env:
SOLUTION_PATH: MinecraftJars.sln
PACKAGE_OUTPUT_DIR: ${{ github.workspace }}\output
NUGET_SOURCE_URL: "https://api.nuget.org/v3/index.json"

jobs:
build:
name: "build"
runs-on: "ubuntu-latest"
steps:
- name: "Checkout"
uses: actions/checkout@v3

- name: "Install dotnet"
uses: actions/setup-dotnet@v2
with:
dotnet-version: "7.0.x"

- name: "Restore packages"
run: dotnet restore ${{ env.SOLUTION_PATH }}

- name: "Build project"
run: dotnet build ${{ env.SOLUTION_PATH }} --no-restore --configuration Release

0 comments on commit 65ae351

Please sign in to comment.