Skip to content

Merge pull request #2 from anpho/workflow #13

Merge pull request #2 from anpho/workflow

Merge pull request #2 from anpho/workflow #13

Workflow file for this run

# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: build and release
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release -o release_package
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Package as zip
run: |
compress-archive -Path release_package\* -DestinationPath rmdup_${{github.sha}}.zip -CompressionLevel Fastest
- name : Upload artifact
uses: actions/upload-artifact@v4
with:
name: rmdup_${{github.sha}}.zip
path: rmdup_${{github.sha}}.zip
- name: release to github
id: create_release
if: startsWith(github.ref,'refs/tags/')
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.sha }}
release_name: ${{ github.sha }}
draft: true
prerelease: false
- name: publish to github
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: rmdup_${{github.sha}}.zip
asset_name: rmdup_${{github.sha}}.zip
asset_content_type: application/zip