Skip to content

Commit 758f68d

Browse files
committed
Add build/release workflow
1 parent 9b03ada commit 758f68d

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
2+
3+
version: 2
4+
updates:
5+
- package-ecosystem: "nuget"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"

.github/workflows/dotnet.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: Build and Test
5+
6+
on:
7+
push:
8+
pull_request:
9+
branches: [ "main" ]
10+
11+
jobs:
12+
build:
13+
name: Build, Test, and Upload Builds
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v3
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v3
19+
with:
20+
dotnet-version: 7.0.x
21+
22+
- name: Set VERSION variable from tag (for tag pushes)
23+
if: ${{ contains(github.ref, 'refs/tags') }}
24+
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
25+
26+
- name: Set VERSION variable from tag (for normal commits)
27+
if: ${{ !contains(github.ref, 'refs/tags') }}
28+
run: echo "VERSION=0.0.0" >> $GITHUB_ENV
29+
30+
- name: Print VERSION variable for debugging
31+
run: echo "$VERSION"
32+
33+
- name: Restore
34+
run: dotnet restore
35+
36+
- name: Publish for Linux x64
37+
run: dotnet publish -c Release -r linux-x64 --self-contained Refresher /p:Version=${VERSION}
38+
39+
- name: Publish for Windows x64
40+
run: dotnet publish -c Release -r win-x64 --self-contained Refresher /p:Version=${VERSION}
41+
42+
- name: Upload Linux x64 build
43+
uses: actions/[email protected]
44+
with:
45+
name: "Refresher for Linux x64"
46+
path: "Refresher/bin/Release/net7.0/linux-x64/publish/"
47+
if-no-files-found: error
48+
retention-days: 30
49+
50+
- name: Upload Windows x64 build
51+
uses: actions/[email protected]
52+
with:
53+
name: "Refresher for Windows x64"
54+
path: "Refresher/bin/Release/net7.0/win-x64/publish/"
55+
if-no-files-found: error
56+
retention-days: 30

.github/workflows/release.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# https://acraven.medium.com/a-nuget-package-workflow-using-github-actions-7da8c6557863
2+
name: Create new release from pushed tag
3+
4+
on:
5+
push:
6+
tags:
7+
- "*"
8+
9+
jobs:
10+
release:
11+
name: Release Built Artifacts
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Wait for builds
15+
uses: lewagon/[email protected]
16+
with:
17+
ref: ${{ github.ref }}
18+
check-name: 'Build, Test, and Upload Builds'
19+
repo-token: ${{ secrets.GITHUB_TOKEN }}
20+
wait-interval: 10
21+
- name: Download artifacts
22+
id: download-artifact
23+
uses: dawidd6/action-download-artifact@v2
24+
with:
25+
github_token: ${{secrets.GITHUB_TOKEN}}
26+
branch: main
27+
workflow: dotnet.yml
28+
workflow_conclusion: success
29+
if_no_artifact_found: fail
30+
skip_unpack: true
31+
- uses: "marvinpinto/action-automatic-releases@latest"
32+
with:
33+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
34+
prerelease: false
35+
draft: true
36+
files: |
37+
*.zip

0 commit comments

Comments
 (0)