Skip to content

Commit bda6505

Browse files
authored
Merge pull request #1647 from ksylvan/0725-fix-release-workflow-race-condition
Simplify Workflow with Single Version Retrieval Step
2 parents d37a1ac + a241c98 commit bda6505

File tree

2 files changed

+24
-12
lines changed

2 files changed

+24
-12
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -93,19 +93,24 @@ jobs:
9393
name: fabric-windows-${{ matrix.arch }}.exe
9494
path: fabric-windows-${{ matrix.arch }}.exe
9595

96-
- name: Get latest tag
97-
if: matrix.os != 'windows-latest'
98-
id: get_latest_tag
99-
run: |
100-
latest_tag=$(git tag --sort=-creatordate | head -n 1)
101-
echo "latest_tag=$latest_tag" >> $GITHUB_ENV
102-
103-
- name: Get latest tag
104-
if: matrix.os == 'windows-latest'
105-
id: get_latest_tag_windows
96+
- name: Get version from source
97+
id: get_version
98+
shell: bash
10699
run: |
107-
$latest_tag = git tag --sort=-creatordate | Select-Object -First 1
108-
Add-Content -Path $env:GITHUB_ENV -Value "latest_tag=$latest_tag"
100+
if [ ! -f "nix/pkgs/fabric/version.nix" ]; then
101+
echo "Error: version.nix file not found"
102+
exit 1
103+
fi
104+
version=$(cat nix/pkgs/fabric/version.nix | tr -d '"' | tr -cd '0-9.')
105+
if [ -z "$version" ]; then
106+
echo "Error: version is empty"
107+
exit 1
108+
fi
109+
if ! echo "$version" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+' > /dev/null; then
110+
echo "Error: Invalid version format: $version"
111+
exit 1
112+
fi
113+
echo "latest_tag=v$version" >> $GITHUB_ENV
109114
110115
- name: Create release if it doesn't exist
111116
shell: bash
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### PR [#1647](https://github.com/danielmiessler/Fabric/pull/1647) by [ksylvan](https://github.com/ksylvan): Simplify Workflow with Single Version Retrieval Step
2+
3+
- Replace git tag lookup with version.nix file reading for release workflow
4+
- Remove OS-specific git tag retrieval steps and add unified version extraction from nix file
5+
- Include version format validation with regex check
6+
- Add error handling for missing version file
7+
- Consolidate cross-platform version logic into single step with bash shell for consistent version parsing

0 commit comments

Comments
 (0)