Skip to content

Commit c6afb5c

Browse files
committed
feat: semantic-release
1 parent 32dac3a commit c6afb5c

File tree

5 files changed

+72
-147
lines changed

5 files changed

+72
-147
lines changed

.github/workflows/demo.yml

Lines changed: 0 additions & 104 deletions
This file was deleted.

.github/workflows/main.yml

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: CI
1+
name: Main
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches:
6+
- "*"
67
pull_request:
7-
branches: [ master ]
88

99
jobs:
1010
build:
@@ -19,27 +19,14 @@ jobs:
1919
TESTS_PROJECT_PARSER: Sitko.Blockly.HtmlParser.Tests
2020
steps:
2121
- name: Checkout code
22-
uses: actions/checkout@v2.3.4
22+
uses: actions/checkout@v2
2323
- name: Install node.js
24-
uses: actions/setup-node@v2.4.1
24+
uses: actions/setup-node@v2
2525
with:
26-
node-version: '15'
26+
node-version: 'lts/*'
2727
cache: 'npm'
2828
cache-dependency-path: |
2929
src/Sitko.Blockly.Blazor/Web/package.json
30-
- name: Install .NET Core 3.1
31-
uses: actions/[email protected]
32-
with:
33-
dotnet-version: '3.1.x'
34-
- name: Install .NET 5.0.x
35-
uses: actions/[email protected]
36-
with:
37-
dotnet-version: '5.0.x'
38-
- name: Install .NET 6.0.x
39-
uses: actions/[email protected]
40-
with:
41-
dotnet-version: '6.0.x'
42-
include-prerelease: true
4330
- name: Build blazor js
4431
working-directory: src/${{ env.BLAZOR_PROJECT }}/Web
4532
shell: bash
@@ -60,3 +47,23 @@ jobs:
6047
run: dotnet test --logger GitHubActions tests/${{ env.TESTS_PROJECT_MAIN }}/${{ env.TESTS_PROJECT_MAIN }}.csproj
6148
- name: Run html parser tests
6249
run: dotnet test --logger GitHubActions tests/${{ env.TESTS_PROJECT_PARSER }}/${{ env.TESTS_PROJECT_PARSER }}.csproj
50+
51+
release:
52+
name: Release
53+
runs-on: ubuntu-latest
54+
needs: [ build ]
55+
if: ${{ github.event_name == 'push' }}
56+
steps:
57+
- name: Checkout
58+
uses: actions/checkout@v2
59+
with:
60+
fetch-depth: 0
61+
persist-credentials: false
62+
- name: Semantic Release
63+
uses: sitkoru/semantic-release-action@v1
64+
env:
65+
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
66+
GIT_AUTHOR_NAME: ${{ secrets.BOT_NAME }}
67+
GIT_AUTHOR_EMAIL: ${{ secrets.BOT_EMAIL }}
68+
GIT_COMMITTER_NAME: ${{ secrets.BOT_NAME }}
69+
GIT_COMMITTER_EMAIL: ${{ secrets.BOT_EMAIL }}

.github/workflows/release.yml

Lines changed: 41 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- '*.*.*'
4+
release:
5+
types:
6+
- published
77

88
jobs:
99
build:
@@ -14,41 +14,59 @@ jobs:
1414
BLAZOR_PROJECT: Sitko.Blockly.Blazor
1515
steps:
1616
- name: Checkout code
17-
uses: actions/checkout@v2.3.4
17+
uses: actions/checkout@v2
1818
- name: Prepare
1919
id: prep
2020
shell: bash
2121
run: |
2222
VERSION=${GITHUB_REF#refs/tags/}
2323
echo ::set-output name=version::${VERSION}
2424
- name: Install node.js
25-
uses: actions/setup-node@v2.4.1
25+
uses: actions/setup-node@v2
2626
with:
27-
node-version: '15'
27+
node-version: 'lts/*'
2828
cache: 'npm'
2929
cache-dependency-path: |
3030
src/Sitko.Blockly.Blazor/Web/package.json
31-
- name: Install .NET Core 3.1
32-
uses: actions/[email protected]
33-
with:
34-
dotnet-version: '3.1.x'
35-
- name: Install .NET 5.0.x
36-
uses: actions/[email protected]
37-
with:
38-
dotnet-version: '5.0.x'
39-
- name: Install .NET 6.0.x
40-
uses: actions/[email protected]
41-
with:
42-
dotnet-version: '6.0.x'
43-
include-prerelease: true
4431
- name: Build blazor js
4532
working-directory: src/${{ env.BLAZOR_PROJECT }}/Web
4633
shell: bash
4734
run: |
4835
npm ci
4936
npm run prod
50-
- name: Create packages
51-
run: dotnet pack -c Release /p:Version=${{ steps.prep.outputs.version }} -o $(pwd)/packages
52-
- name: Push to Nuget
53-
run: find packages -name *.nupkg -exec dotnet nuget push {} -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} \;
37+
- name: Publish main library
38+
uses: sitkoru/nuget-release-action@v1
39+
with:
40+
version: ${{ steps.prep.outputs.version }}
41+
project_path: src/MYCG.Blockly/MYCG.Blockly.csproj
42+
nuget_host: https://api.nuget.org/v3/index.json
43+
nuget_token: ${{ secrets.NUGET_API_KEY }}
44+
- name: Publish Blazor library
45+
uses: sitkoru/nuget-release-action@v1
46+
with:
47+
version: ${{ steps.prep.outputs.version }}
48+
project_path: src/MYCG.Blockly.Blazor/MYCG.Blockly.Blazor.csproj
49+
nuget_host: https://api.nuget.org/v3/index.json
50+
nuget_token: ${{ secrets.NUGET_API_KEY }}
51+
- name: Publish AntDesign library
52+
uses: sitkoru/nuget-release-action@v1
53+
with:
54+
version: ${{ steps.prep.outputs.version }}
55+
project_path: src/MYCG.Blockly.AntDesign/MYCG.Blockly.AntDesign.csproj
56+
nuget_host: https://api.nuget.org/v3/index.json
57+
nuget_token: ${{ secrets.NUGET_API_KEY }}
58+
- name: Publish EF library
59+
uses: sitkoru/nuget-release-action@v1
60+
with:
61+
version: ${{ steps.prep.outputs.version }}
62+
project_path: src/MYCG.Blockly.EntityFrameworkCore/MYCG.Blockly.EntityFrameworkCore.csproj
63+
nuget_host: https://api.nuget.org/v3/index.json
64+
nuget_token: ${{ secrets.NUGET_API_KEY }}
65+
- name: Publish HtmlParser library
66+
uses: sitkoru/nuget-release-action@v1
67+
with:
68+
version: ${{ steps.prep.outputs.version }}
69+
project_path: src/MYCG.Blockly.HtmlParser/MYCG.Blockly.HtmlParser.csproj
70+
nuget_host: https://api.nuget.org/v3/index.json
71+
nuget_token: ${{ secrets.NUGET_API_KEY }}
5472

Sitko.Blockly.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ ProjectSection(SolutionItems) = preProject
2121
LICENSE.md = LICENSE.md
2222
README.md = README.md
2323
docker-compose.yml = docker-compose.yml
24+
release.config.js = release.config.js
2425
EndProjectSection
2526
EndProject
2627
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{BE2C5E4A-BFBD-4645-AE0A-8B57A9EC1CB2}"
@@ -36,7 +37,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
3637
ProjectSection(SolutionItems) = preProject
3738
.github\workflows\main.yml = .github\workflows\main.yml
3839
.github\workflows\release.yml = .github\workflows\release.yml
39-
.github\workflows\demo.yml = .github\workflows\demo.yml
4040
EndProjectSection
4141
EndProject
4242
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apps", "apps", "{32D6C989-DF2C-4C06-BD48-C322E72888B9}"

release.config.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
module.exports = {
2+
"extends": "@sitkoru/semantic-release-config",
3+
tagFormat: "${version}"
4+
};

0 commit comments

Comments
 (0)