Skip to content

Commit a181d40

Browse files
authored
Merge pull request #67 from TraGicCode/refactor-automated-release-process-fix-10
Refactor automated release process fix round 10
2 parents 89aadd5 + 9d7aa3d commit a181d40

4 files changed

Lines changed: 57 additions & 50 deletions

File tree

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Build and Publish Docker Image
22

33
on:
4-
workflow_run:
5-
workflows: [Release]
6-
types:
7-
- completed
4+
release:
5+
types: [published]
86

97
permissions:
108
id-token: write
@@ -18,9 +16,20 @@ jobs:
1816
- name: Checkout
1917
uses: actions/checkout@v5
2018

21-
- name: Get semver without "v"
19+
- name: Extract version (without v)
2220
id: version
23-
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
21+
run: |
22+
if [ "${{ github.event_name }}" = "release" ]; then
23+
# Extract version from release tag (remove any 'v' prefix)
24+
VERSION="${{ github.event.release.tag_name }}"
25+
VERSION=${VERSION#v} # Remove 'v' prefix if present
26+
else
27+
VERSION="${{ github.event.inputs.version }}"
28+
VERSION=${VERSION#v} # Remove 'v' prefix if present
29+
fi
30+
31+
echo "version=$VERSION" >> $GITHUB_OUTPUT
32+
echo "Syncing version: $VERSION"
2433
2534
- name: Set up Docker Buildx
2635
uses: docker/setup-buildx-action@v3
@@ -40,7 +49,7 @@ jobs:
4049
with:
4150
images: tragiccode/busly-cli
4251
tags: |
43-
${{ steps.version.outputs.VERSION }}
52+
${{ steps.version.outputs.version }}
4453
latest
4554
4655
- name: Build and push Docker image
@@ -50,7 +59,7 @@ jobs:
5059
context: .
5160
file: ./src/BuslyCLI.Console/Dockerfile
5261
build-args: |
53-
APP_VERSION=${{ steps.version.outputs.VERSION }}
62+
APP_VERSION=${{ steps.version.outputs.version }}
5463
push: true
5564
tags: ${{ steps.meta.outputs.tags }}
5665
labels: ${{ steps.meta.outputs.labels }}

.github/workflows/dotnet_tool_build.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Build and Publish .NET Tool
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
build-and-pack:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v5
14+
15+
- name: Extract version (without v)
16+
id: version
17+
run: |
18+
if [ "${{ github.event_name }}" = "release" ]; then
19+
# Extract version from release tag (remove any 'v' prefix)
20+
VERSION="${{ github.event.release.tag_name }}"
21+
VERSION=${VERSION#v} # Remove 'v' prefix if present
22+
else
23+
VERSION="${{ github.event.inputs.version }}"
24+
VERSION=${VERSION#v} # Remove 'v' prefix if present
25+
fi
26+
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
echo "Syncing version: $VERSION"
29+
30+
- name: Build and Pack as .NET tool
31+
uses: devcontainers/ci@v0.3
32+
with:
33+
runCmd: |
34+
dotnet cake --target Pack-DotNetTool --package-version ${{ steps.version.outputs.version }}
35+
36+
- name: Publish to NuGet (optional)
37+
run: dotnet nuget push ./artifacts/nupkgs/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}

.github/workflows/release.yml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@ jobs:
2222
version=$(grep -m 1 -oP '^##\s*\[\Kv[0-9]+\.[0-9]+\.[0-9]+' CHANGELOG.md)
2323
echo "version=$version" >> $GITHUB_OUTPUT
2424
25-
# - name: Create and push git tag
26-
# run: |
27-
# version=${{ steps.changelog.outputs.version }}
28-
29-
# git config user.name "github-actions[bot]"
30-
# git config user.email "github-actions[bot]@users.noreply.github.com"
31-
32-
# git tag "v$version"
33-
# git push origin "v$version"
34-
35-
3625
# gh changelog new --latest
3726
- name: "Generate Release Changelog"
3827
run: |
@@ -44,12 +33,12 @@ jobs:
4433
# This creates a tag but doesn't trigger a "push event of the tag" FYI
4534
- name: Create GitHub Release
4635
id: create_release
47-
uses: actions/create-release@v1
36+
uses: softprops/action-gh-release@v2
4837
env:
49-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN_FOR_RELEASE_PUBLISH }}
5039
with:
5140
tag_name: ${{ steps.changelog.outputs.version }}
52-
release_name: Release ${{ steps.changelog.outputs.version }}
41+
name: Release ${{ steps.changelog.outputs.version }}
5342
draft: false
5443
prerelease: false
5544
body_path: CHANGELOG.md

0 commit comments

Comments
 (0)