Skip to content

Commit

Permalink
feat: semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
SonicGD committed Jan 13, 2022
1 parent 32dac3a commit c6afb5c
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 147 deletions.
104 changes: 0 additions & 104 deletions .github/workflows/demo.yml

This file was deleted.

45 changes: 26 additions & 19 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: CI
name: Main

on:
push:
branches: [ master ]
branches:
- "*"
pull_request:
branches: [ master ]

jobs:
build:
Expand All @@ -19,27 +19,14 @@ jobs:
TESTS_PROJECT_PARSER: Sitko.Blockly.HtmlParser.Tests
steps:
- name: Checkout code
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2
- name: Install node.js
uses: actions/setup-node@v2.4.1
uses: actions/setup-node@v2
with:
node-version: '15'
node-version: 'lts/*'
cache: 'npm'
cache-dependency-path: |
src/Sitko.Blockly.Blazor/Web/package.json
- name: Install .NET Core 3.1
uses: actions/setup-dotnet@v1.8.2
with:
dotnet-version: '3.1.x'
- name: Install .NET 5.0.x
uses: actions/setup-dotnet@v1.8.2
with:
dotnet-version: '5.0.x'
- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v1.8.2
with:
dotnet-version: '6.0.x'
include-prerelease: true
- name: Build blazor js
working-directory: src/${{ env.BLAZOR_PROJECT }}/Web
shell: bash
Expand All @@ -60,3 +47,23 @@ jobs:
run: dotnet test --logger GitHubActions tests/${{ env.TESTS_PROJECT_MAIN }}/${{ env.TESTS_PROJECT_MAIN }}.csproj
- name: Run html parser tests
run: dotnet test --logger GitHubActions tests/${{ env.TESTS_PROJECT_PARSER }}/${{ env.TESTS_PROJECT_PARSER }}.csproj

release:
name: Release
runs-on: ubuntu-latest
needs: [ build ]
if: ${{ github.event_name == 'push' }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
persist-credentials: false
- name: Semantic Release
uses: sitkoru/semantic-release-action@v1
env:
GH_TOKEN: ${{ secrets.BOT_TOKEN }}
GIT_AUTHOR_NAME: ${{ secrets.BOT_NAME }}
GIT_AUTHOR_EMAIL: ${{ secrets.BOT_EMAIL }}
GIT_COMMITTER_NAME: ${{ secrets.BOT_NAME }}
GIT_COMMITTER_EMAIL: ${{ secrets.BOT_EMAIL }}
64 changes: 41 additions & 23 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Release

on:
push:
tags:
- '*.*.*'
release:
types:
- published

jobs:
build:
Expand All @@ -14,41 +14,59 @@ jobs:
BLAZOR_PROJECT: Sitko.Blockly.Blazor
steps:
- name: Checkout code
uses: actions/checkout@v2.3.4
uses: actions/checkout@v2
- name: Prepare
id: prep
shell: bash
run: |
VERSION=${GITHUB_REF#refs/tags/}
echo ::set-output name=version::${VERSION}
- name: Install node.js
uses: actions/setup-node@v2.4.1
uses: actions/setup-node@v2
with:
node-version: '15'
node-version: 'lts/*'
cache: 'npm'
cache-dependency-path: |
src/Sitko.Blockly.Blazor/Web/package.json
- name: Install .NET Core 3.1
uses: actions/setup-dotnet@v1.8.2
with:
dotnet-version: '3.1.x'
- name: Install .NET 5.0.x
uses: actions/setup-dotnet@v1.8.2
with:
dotnet-version: '5.0.x'
- name: Install .NET 6.0.x
uses: actions/setup-dotnet@v1.8.2
with:
dotnet-version: '6.0.x'
include-prerelease: true
- name: Build blazor js
working-directory: src/${{ env.BLAZOR_PROJECT }}/Web
shell: bash
run: |
npm ci
npm run prod
- name: Create packages
run: dotnet pack -c Release /p:Version=${{ steps.prep.outputs.version }} -o $(pwd)/packages
- name: Push to Nuget
run: find packages -name *.nupkg -exec dotnet nuget push {} -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} \;
- name: Publish main library
uses: sitkoru/nuget-release-action@v1
with:
version: ${{ steps.prep.outputs.version }}
project_path: src/MYCG.Blockly/MYCG.Blockly.csproj
nuget_host: https://api.nuget.org/v3/index.json
nuget_token: ${{ secrets.NUGET_API_KEY }}
- name: Publish Blazor library
uses: sitkoru/nuget-release-action@v1
with:
version: ${{ steps.prep.outputs.version }}
project_path: src/MYCG.Blockly.Blazor/MYCG.Blockly.Blazor.csproj
nuget_host: https://api.nuget.org/v3/index.json
nuget_token: ${{ secrets.NUGET_API_KEY }}
- name: Publish AntDesign library
uses: sitkoru/nuget-release-action@v1
with:
version: ${{ steps.prep.outputs.version }}
project_path: src/MYCG.Blockly.AntDesign/MYCG.Blockly.AntDesign.csproj
nuget_host: https://api.nuget.org/v3/index.json
nuget_token: ${{ secrets.NUGET_API_KEY }}
- name: Publish EF library
uses: sitkoru/nuget-release-action@v1
with:
version: ${{ steps.prep.outputs.version }}
project_path: src/MYCG.Blockly.EntityFrameworkCore/MYCG.Blockly.EntityFrameworkCore.csproj
nuget_host: https://api.nuget.org/v3/index.json
nuget_token: ${{ secrets.NUGET_API_KEY }}
- name: Publish HtmlParser library
uses: sitkoru/nuget-release-action@v1
with:
version: ${{ steps.prep.outputs.version }}
project_path: src/MYCG.Blockly.HtmlParser/MYCG.Blockly.HtmlParser.csproj
nuget_host: https://api.nuget.org/v3/index.json
nuget_token: ${{ secrets.NUGET_API_KEY }}

2 changes: 1 addition & 1 deletion Sitko.Blockly.sln
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ProjectSection(SolutionItems) = preProject
LICENSE.md = LICENSE.md
README.md = README.md
docker-compose.yml = docker-compose.yml
release.config.js = release.config.js
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{BE2C5E4A-BFBD-4645-AE0A-8B57A9EC1CB2}"
Expand All @@ -36,7 +37,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
ProjectSection(SolutionItems) = preProject
.github\workflows\main.yml = .github\workflows\main.yml
.github\workflows\release.yml = .github\workflows\release.yml
.github\workflows\demo.yml = .github\workflows\demo.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "apps", "apps", "{32D6C989-DF2C-4C06-BD48-C322E72888B9}"
Expand Down
4 changes: 4 additions & 0 deletions release.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
"extends": "@sitkoru/semantic-release-config",
tagFormat: "${version}"
};

0 comments on commit c6afb5c

Please sign in to comment.