Skip to content

Commit 0411f92

Browse files
authored
Configure a release workflow
1 parent edf123f commit 0411f92

File tree

3 files changed

+85
-10
lines changed

3 files changed

+85
-10
lines changed

.github/workflows/release.yml

Lines changed: 71 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,86 @@
11
name: Release
2-
32
on:
43
workflow_dispatch:
54
inputs:
65
release-version:
7-
description: "Release version"
8-
default: "1.0.0"
6+
description: 'Release version'
7+
required: true
8+
default: '0.0.1'
9+
push:
10+
tags:
11+
- '*'
12+
13+
env:
14+
release-version: ${{ github.event.inputs.release-version || github.ref_name }}
915

1016
jobs:
17+
test:
18+
name: Test ${{github.ref_name}}
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
ref: main
27+
28+
- name: Check permissions
29+
if: github.event.inputs.release-version && github.actor != 'Serg046'
30+
env:
31+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
gh run cancel ${{ github.run_id }} && gh run watch ${{ github.run_id }}
34+
exit 0
35+
36+
- name: Install .NET SDK
37+
uses: actions/setup-dotnet@v4
38+
with:
39+
dotnet-version: |
40+
2.x
41+
9.x
1142
12-
build-and-test:
13-
14-
runs-on: windows-latest
43+
- name: Install libssl
44+
run: |
45+
wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
46+
sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
47+
48+
- name: Test
49+
run: dotnet test
50+
51+
release:
52+
name: Release ${{github.ref_name}}
53+
needs: test
54+
runs-on: ubuntu-latest
1555

1656
steps:
1757
- name: Checkout
1858
uses: actions/checkout@v4
1959
with:
2060
fetch-depth: 0
61+
ref: main
2162

22-
- name: Build and test
23-
run: dotnet test
63+
- name: Set the package release version
64+
uses: jacobtomlinson/gha-find-replace@v3
65+
with:
66+
find: "<Version>.*</Version>"
67+
replace: "<Version>${{env.release-version}}</Version>"
68+
include: "dotMap/dotMap.csproj"
69+
regex: true
70+
71+
- name: Build and pack
72+
run: dotnet pack dotMap/dotMap.csproj -c Release
73+
74+
- name: Publish artifacts
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: NuGet packages
78+
path: dotMap/**/*.nupkg
79+
80+
- name: Save and push the new version
81+
run: |
82+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
83+
git config --local user.name "github-actions[bot]"
84+
git add dotMap/dotMap.csproj
85+
git commit -m "Release v${{env.release-version}}"
86+
git push

docs/images/logo.png

-1.46 KB
Loading

dotMap/dotMap.csproj

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,20 @@
66
<ImplicitUsings>true</ImplicitUsings>
77
<LangVersion>latest</LangVersion>
88
<Nullable>enable</Nullable>
9-
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
10-
<Configurations>Debug;Release</Configurations>
9+
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
10+
<Configurations>Debug;Release</Configurations>
11+
<PackageId>dotMap</PackageId>
12+
<Title>dotMap</Title>
13+
<Version>0.0.0</Version>
14+
<Description>Convention-based object-to-object compile time mapper for .NET</Description>
15+
<Authors>Sergey Aseev (Serg046)</Authors>
16+
<Company>Devexperts</Company>
17+
<PackageProjectUrl>https://github.com/devexperts/dotMap</PackageProjectUrl>
18+
<RepositoryUrl>https://github.com/devexperts/dotMap</RepositoryUrl>
19+
<RepositoryType>git</RepositoryType>
20+
<PackageTags>dotMap mapping mapper automapper auto-mapper auto-mapping</PackageTags>
21+
<IncludeSymbols>true</IncludeSymbols>
22+
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1123
</PropertyGroup>
1224

1325
<ItemGroup>

0 commit comments

Comments
 (0)