Skip to content

Commit

Permalink
feat: update pipelines to add versionize
Browse files Browse the repository at this point in the history
  • Loading branch information
andrea-dematte-zupit committed Feb 14, 2024
1 parent 517f04b commit 460b56d
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 26 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish-new-version-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Bump Version common workflow

on:
workflow_call:
inputs:
WORKING_DIRECTORY:
required: true
type: string
PROJECT_NAME_COMMIT_SUFFIX:
required: true
type: string

jobs:
publish-new-version:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ${{ inputs.WORKING_DIRECTORY }}
outputs:
outcome: ${{ steps.versionize.outcome }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Install Versionize
run: dotnet tool install --global Versionize
- name: Setup git
run: |
git config --local user.email "[email protected]"
git config --local user.name "ZupitDevs"
- name: Versionize Release
id: versionize
run: versionize --changelog-all --exit-insignificant-commits --proj-version-bump-logic --skip-tag --commit-suffix "[${{ inputs.PROJECT_NAME_COMMIT_SUFFIX }}]"
continue-on-error: true
- name: No release required
if: steps.versionize.outcome != 'success'
run: echo "Skipping publishing. No release required."
- name: Push changes to GitHub
if: steps.versionize.outcome == 'success'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
tags: true
43 changes: 23 additions & 20 deletions .github/workflows/release-common.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release common workflow
name: Release workflow

on:
workflow_call:
Expand All @@ -12,25 +12,28 @@ on:
DOTNET_IMAGE:
required: true
type: string
PROJECT_NAME_COMMIT_SUFFIX:
required: true
type: string

jobs:
test:
uses: ./.github/workflows/test-common.yml
with:
DOTNET_IMAGE: ${{ inputs.DOTNET_IMAGE }}
WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }}
publish-new-version:
needs: [ test ]
uses: ./.github/workflows/publish-new-version-common.yml
with:
WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }}
PROJECT_NAME_COMMIT_SUFFIX: ${{ inputs.PROJECT_NAME_COMMIT_SUFFIX }}
release:
runs-on: ubuntu-latest
container:
image: ${{ inputs.DOTNET_IMAGE }}
defaults:
run:
working-directory: ${{ inputs.WORKING_DIRECTORY }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run tests
run: dotnet test

- name: Create NuGet package
run: dotnet pack -c Release -o ./artifacts/${{ inputs.PROJECT }} ${{ inputs.PROJECT }}

- name: Publish NuGet package
run: dotnet nuget push ./artifacts/${{ inputs.PROJECT }}/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.ZUPIT_NUGET_TOKEN }}
needs: [ test, publish-new-version ]
if: needs.publish-new-version.outcome == 'success'
uses: ./.github/workflows/release-nuget-common.yml
with:
DOTNET_IMAGE: ${{ inputs.DOTNET_IMAGE }}
WORKING_DIRECTORY: ${{ inputs.WORKING_DIRECTORY }}
PROJECT: ${{ inputs.PROJECT }}
secrets: inherit
36 changes: 36 additions & 0 deletions .github/workflows/release-nuget-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release to nuget

on:
workflow_call:
inputs:
WORKING_DIRECTORY:
required: true
type: string
PROJECT:
required: true
type: string
DOTNET_IMAGE:
required: true
type: string

jobs:
release:
runs-on: ubuntu-latest
container:
image: ${{ inputs.DOTNET_IMAGE }}
defaults:
run:
working-directory: ${{ inputs.WORKING_DIRECTORY }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Create NuGet package
run: dotnet pack -c Release -o ./artifacts/${{ inputs.PROJECT }} ${{ inputs.PROJECT }}

# - name: Publish NuGet package
# run: dotnet nuget push ./artifacts/${{ inputs.PROJECT }}/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.ZUPIT_NUGET_TOKEN }}

- name: Publish NuGet package test
run: echo "Publish to Nuget"
3 changes: 2 additions & 1 deletion .github/workflows/release-version-endpoint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ on:
workflow_dispatch:

jobs:
release-version-endpoint:
release-common:
uses: ./.github/workflows/release-common.yml
with:
DOTNET_IMAGE: 'mcr.microsoft.com/dotnet/sdk:8.0.101-alpine3.18-amd64'
WORKING_DIRECTORY: Zupit.VersionEndpoint
PROJECT: Zupit.VersionEndpoint
PROJECT_NAME_COMMIT_SUFFIX: VersionEndpoint
secrets: inherit
27 changes: 27 additions & 0 deletions .github/workflows/test-common.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Test common workflow

on:
workflow_call:
inputs:
WORKING_DIRECTORY:
required: true
type: string
DOTNET_IMAGE:
required: true
type: string

jobs:
test:
runs-on: ubuntu-latest
container:
image: ${{ inputs.DOTNET_IMAGE }}
defaults:
run:
working-directory: ${{ inputs.WORKING_DIRECTORY }}

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Run tests
run: dotnet test
84 changes: 84 additions & 0 deletions Zupit.VersionEndpoint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Change Log

All notable changes to this project will be documented in this file. See [versionize](https://github.com/versionize/versionize) for commit guidelines.

<a name="0.0.4"></a>
## [0.0.4](https://www.github.com/zupit-it/zupit-dotnet/releases/tag/v0.0.4) (2024-02-14)

### Bug Fixes

* bump from csprj ([44d0dea](https://www.github.com/zupit-it/zupit-dotnet/commit/44d0dea0149152c9f17438e7d0d13593a5914054))

### Other

* no release ([9323cea](https://www.github.com/zupit-it/zupit-dotnet/commit/9323cea029f1f0333a5590e6f4467b82b9e784f4))

<a name="0.1.1"></a>
## [0.1.1](https://www.github.com/zupit-it/zupit-dotnet/releases/tag/v0.1.1) (2024-02-14)

### Bug Fixes

* something ([cb5e974](https://www.github.com/zupit-it/zupit-dotnet/commit/cb5e974d03e7142fa75e90aae8ae6f3045af5e12))

<a name="0.1.0"></a>
## [0.1.0](https://www.github.com/zupit-it/zupit-dotnet/releases/tag/v0.1.0) (2024-02-14)

### Features

* new feature ([5599ddc](https://www.github.com/zupit-it/zupit-dotnet/commit/5599ddc3d7929378d171bb3687933e0bb93754a5))

<a name="0.0.2"></a>
## [0.0.2](https://www.github.com/zupit-it/zupit-dotnet/releases/tag/v0.0.2) (2024-02-14)

### Features

* add first pipeline ([5f5f09c](https://www.github.com/zupit-it/zupit-dotnet/commit/5f5f09c14e26d6a615186960c4e7284c05451fc4))
* add version endpoint library ([0bbc6b6](https://www.github.com/zupit-it/zupit-dotnet/commit/0bbc6b6e40248ba1d5620ff43d3403089992ef3e))
* feat ([92cba1c](https://www.github.com/zupit-it/zupit-dotnet/commit/92cba1ca8878e7e7760abbff9a1eaa52a1ce62d6))
* test ([3da9d29](https://www.github.com/zupit-it/zupit-dotnet/commit/3da9d294fa071525c67ddeb6a7388479c4d9e061))
* test ([871a632](https://www.github.com/zupit-it/zupit-dotnet/commit/871a6327f18ead096d635ca8b0affa2b462558a3))
* test feat ([82f71ba](https://www.github.com/zupit-it/zupit-dotnet/commit/82f71ba1f9cade96f4160aaab958258e698cd1a9))
* test feature ([4e6603d](https://www.github.com/zupit-it/zupit-dotnet/commit/4e6603d4ef5a46d8e16cb3e950138fe08a3c55ab))
* test2 ([7af3446](https://www.github.com/zupit-it/zupit-dotnet/commit/7af344698845ee19e14318cf4179d2008da1c17b))
* update icon ([517f04b](https://www.github.com/zupit-it/zupit-dotnet/commit/517f04bbbc93397d04797386e8452fd1fe5b466c))
* update pipelines to add versionize ([d663449](https://www.github.com/zupit-it/zupit-dotnet/commit/d663449d76526f0f6d943ef09fba7eae8112ff8b))

### Bug Fixes

* asd ([433e97e](https://www.github.com/zupit-it/zupit-dotnet/commit/433e97e9b57ded09559e733c1c12f23bf7c41557))
* dsa ([ec5d867](https://www.github.com/zupit-it/zupit-dotnet/commit/ec5d86729d16fffe0db1b7fd66f25875d7a957d1))
* input ([0a93f97](https://www.github.com/zupit-it/zupit-dotnet/commit/0a93f9715f404ee1d269b8643b1729ded8e7c1de))
* pipeline ([41da698](https://www.github.com/zupit-it/zupit-dotnet/commit/41da698e6a444b4e7285704b59f3256f21b12d13))
* text ([e51808c](https://www.github.com/zupit-it/zupit-dotnet/commit/e51808cab3b7c5c5d3b4ca65d2292861b3178216))

### Other

* Initial commit ([1bf1948](https://www.github.com/zupit-it/zupit-dotnet/commit/1bf194870372f90e5371b57b5483f2c6c70f6acf))
* **release:** 0.0.2-alpha ([d43e269](https://www.github.com/zupit-it/zupit-dotnet/commit/d43e269e38da43806eb3268ebaac36c20b6e3a03))

<a name="0.0.2-alpha"></a>
## [0.0.2-alpha](https://www.github.com/zupit-it/zupit-dotnet/releases/tag/v0.0.2-alpha) (2024-02-14)

### Features

* add first pipeline ([5f5f09c](https://www.github.com/zupit-it/zupit-dotnet/commit/5f5f09c14e26d6a615186960c4e7284c05451fc4))
* add version endpoint library ([0bbc6b6](https://www.github.com/zupit-it/zupit-dotnet/commit/0bbc6b6e40248ba1d5620ff43d3403089992ef3e))
* feat ([92cba1c](https://www.github.com/zupit-it/zupit-dotnet/commit/92cba1ca8878e7e7760abbff9a1eaa52a1ce62d6))
* test ([3da9d29](https://www.github.com/zupit-it/zupit-dotnet/commit/3da9d294fa071525c67ddeb6a7388479c4d9e061))
* test ([871a632](https://www.github.com/zupit-it/zupit-dotnet/commit/871a6327f18ead096d635ca8b0affa2b462558a3))
* test feat ([82f71ba](https://www.github.com/zupit-it/zupit-dotnet/commit/82f71ba1f9cade96f4160aaab958258e698cd1a9))
* test feature ([4e6603d](https://www.github.com/zupit-it/zupit-dotnet/commit/4e6603d4ef5a46d8e16cb3e950138fe08a3c55ab))
* test2 ([7af3446](https://www.github.com/zupit-it/zupit-dotnet/commit/7af344698845ee19e14318cf4179d2008da1c17b))
* update icon ([517f04b](https://www.github.com/zupit-it/zupit-dotnet/commit/517f04bbbc93397d04797386e8452fd1fe5b466c))
* update pipelines to add versionize ([d663449](https://www.github.com/zupit-it/zupit-dotnet/commit/d663449d76526f0f6d943ef09fba7eae8112ff8b))

### Bug Fixes

* input ([0a93f97](https://www.github.com/zupit-it/zupit-dotnet/commit/0a93f9715f404ee1d269b8643b1729ded8e7c1de))
* pipeline ([41da698](https://www.github.com/zupit-it/zupit-dotnet/commit/41da698e6a444b4e7285704b59f3256f21b12d13))
* text ([e51808c](https://www.github.com/zupit-it/zupit-dotnet/commit/e51808cab3b7c5c5d3b4ca65d2292861b3178216))

### Other

* Initial commit ([1bf1948](https://www.github.com/zupit-it/zupit-dotnet/commit/1bf194870372f90e5371b57b5483f2c6c70f6acf))

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks>
Expand All @@ -8,7 +8,7 @@

<PropertyGroup>
<PackageId>Zupit.VersionEndpoint</PackageId>
<Version>0.0.2-alpha</Version>
<Version>0.0.2</Version>
<Authors>Zupit Developers</Authors>
<Company>Zupit</Company>
<PackageTags>Version;Endpoint;Zupit</PackageTags>
Expand All @@ -21,11 +21,11 @@
</PropertyGroup>

<ItemGroup>
<None Include="README.md" Pack="true" PackagePath="\"/>
<None Include="../../icon.png" Pack="true" PackagePath="\"/>
<None Include="README.md" Pack="true" PackagePath="\" />
<None Include="../../icon.png" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App"/>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
</Project>

0 comments on commit 460b56d

Please sign in to comment.