Skip to content

Commit

Permalink
Create build.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
DrMeepso authored Nov 6, 2024
1 parent 22505ee commit 47d631d
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Publish and Release on Commit

on:
push:
branches:
- main # Trigger workflow on push to the main branch; change this as needed

jobs:
build:
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v3

# Step 2: Set up .NET
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x' # Use the appropriate version

# Step 3: Restore dependencies
- name: Restore dependencies
run: dotnet restore

# Step 4: Publish the project
- name: Publish the application
run: dotnet publish -c Release -o ./publish # Output to ./publish folder

# Step 5: Create a release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.sha }}
release_name: Release ${{ github.sha }}
draft: false
prerelease: false

# Step 6: Upload published files to release
- name: Upload .NET Publish Artifacts
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./publish
asset_name: published_app.zip
asset_content_type: application/zip

0 comments on commit 47d631d

Please sign in to comment.