Skip to content

Commit

Permalink
Merge pull request #37 from deveel/artifact-versioning
Browse files Browse the repository at this point in the history
Artifact Versioning
  • Loading branch information
tsutomi authored Jul 6, 2024
2 parents 981707d + 0f08f38 commit 1ba64b8
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 40 deletions.
20 changes: 14 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,28 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup GitFlow
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '5.x'

- name: Determine Version
uses: gittools/actions/gitversion/[email protected]

- name: Setup .NET 8.0 Framework
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Build
run: dotnet build -c Release --version-suffix $GITHUB_RUN_ID
run: dotnet build -c Release --no-restore /p:Version="${{ env.GitVersion_SemVer }}" /p:AssemblyVersion="${{ env.GitVersion_AssemblySemVer }}" /p:FileVersion="${{ env.GitVersion_AssemblySemFileVer }}"

- name: Pack NuGet
run: dotnet pack -c Release --no-build --include-symbols --include-source --version-suffix $GITHUB_RUN_ID -o ./nuget
- name: Push NutGet
run: dotnet nuget push ./nuget/*.nupkg -s "https://nuget.pkg.github.com/deveel/index.json" --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}}
- name: Pack the Nuget Packages
run: dotnet pack -c Release --no-build --no-restore --include-symbols --include-source --output nupkgs /p:PackageVersion="${{ env.GitVersion_NuGetVersionV2 }}"

- name: Publish the Nuget Packages to the GitHub Package Registry
run: dotnet nuget push **/*.nupkg --skip-duplicate --api-key ${{ secrets.GITHUB_TOKEN }} --source "https://nuget.pkg.github.com/deveel/index.json"

clean:
name: "Clean Old Packages"
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/manual-release.yml

This file was deleted.

27 changes: 17 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,20 @@ permissions:
packages: write

on:
push:
tags:
- '*'
release:
types: [published]
workflow_dispatch:
inputs:
version:
type: string
required: true
description: The version to be published

jobs:
release:
runs-on: ubuntu-latest
strategy:
fail-fast: true
fail-fast: false
matrix:
dotnet-version: [ '6.0.x', '7.0.x', '8.0.x' ]

Expand Down Expand Up @@ -61,14 +66,16 @@ jobs:
needs: release
runs-on: ubuntu-latest
steps:
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
with:
strip_v: true
- name: Extract the Version
run: echo "VERSION=$(echo ${{ github.event.release.tag_name }} | sed -e 's/^v//')" >> $GITHUB_ENV
if: github.event.release.tag_name != null

- name: Set the Version from Input
run: echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
if: github.event.release.tag_name == null

- name: Pack NuGet
run: dotnet pack -p:PackageVersion=${{steps.tag.outputs.tag}} -c Release -o ./nuget -p:Version=${{steps.tag.outputs.tag}}
run: dotnet pack -p:PackageVersion=${{ env.VERSION }} -c Release -o ./nuget -p:Version=${{ env.VERSION }}

- name: Push Github Nuget
run: dotnet nuget push ./nuget/*.nupkg -s "https://nuget.pkg.github.com/deveel/index.json" --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}}
Expand Down
23 changes: 23 additions & 0 deletions GitVersion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
mode: ContinuousDeployment
branches:
main:
tag: ''
increment: Patch
regex: ^main$
source-branches: ['feature']
prevent-increment-of-merged-branch-version: true
tracks-release-branches: true
is-release-branch: true
feature:
tag: useBranchName
increment: None
regex: ^feature[-/]
source-branches: ['main']
tracks-release-branches: false
is-release-branch: false
ignore:
sha: []
merge-message-formats: {}
commit-message-incrementing: Enabled
assembly-versioning-scheme: MajorMinorPatch
continuous-delivery-fallback-tag: alpha

0 comments on commit 1ba64b8

Please sign in to comment.