Skip to content

Commit 20c0518

Browse files
committed
Add make release - one-command release workflow
Automates version extraction, build, tag, and GitHub release creation. Updates deprecated GitHub Actions (create-release@v1) to maintained softprops/action-gh-release@v2.
1 parent 25690fd commit 20c0518

2 files changed

Lines changed: 37 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,9 @@ jobs:
2020
./build-dist.sh
2121
2222
- name: Create Release
23-
id: create_release
24-
uses: actions/create-release@v1
25-
env:
26-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
uses: softprops/action-gh-release@v2
2724
with:
28-
tag_name: ${{ github.ref }}
29-
release_name: Release ${{ github.ref }}
30-
draft: false
31-
prerelease: false
32-
33-
- name: Upload Installer
34-
uses: actions/upload-release-asset@v1
25+
files: dist/shipnode-installer.sh
26+
generate_release_notes: true
3527
env:
3628
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
with:
38-
upload_url: ${{ steps.create_release.outputs.upload_url }}
39-
asset_path: ./dist/shipnode-installer.sh
40-
asset_name: shipnode-installer.sh
41-
asset_content_type: application/x-sh

Makefile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: help build clean install test
1+
.PHONY: help build clean install test release
22

33
help:
44
@echo "ShipNode Build System"
@@ -8,6 +8,7 @@ help:
88
@echo " make clean - Remove dist directory"
99
@echo " make install - Install locally from source"
1010
@echo " make test - Test the installer"
11+
@echo " make release - Create and publish a new release"
1112

1213
build:
1314
@./build-dist.sh
@@ -24,3 +25,35 @@ install:
2425
test: build
2526
@echo "Testing installer..."
2627
@bash dist/shipnode-installer.sh
28+
29+
release:
30+
@echo "Creating release..."
31+
@# Extract version from lib/core.sh
32+
@VERSION=$$(grep -m1 '^VERSION=' lib/core.sh | cut -d'"' -f2); \
33+
if [ -z "$$VERSION" ]; then \
34+
echo "Error: Could not extract VERSION from lib/core.sh"; \
35+
exit 1; \
36+
fi; \
37+
echo "Version: $$VERSION"; \
38+
\
39+
echo "Syncing version to build-dist.sh..."; \
40+
sed -i "s/^VERSION=.*/VERSION=\"$$VERSION\"/" build-dist.sh; \
41+
sed -i "s/^VERSION=.*/VERSION=\"$$VERSION\"/" build-dist.sh; \
42+
\
43+
echo "Building distribution..."; \
44+
./build-dist.sh; \
45+
\
46+
echo "Creating git tag v$$VERSION..."; \
47+
git tag -a "v$$VERSION" -m "Release v$$VERSION" || (echo "Tag already exists or git error"; exit 1); \
48+
\
49+
echo "Pushing tag to origin..."; \
50+
git push origin "v$$VERSION"; \
51+
\
52+
echo "Creating GitHub release..."; \
53+
gh release create "v$$VERSION" \
54+
dist/shipnode-installer.sh \
55+
--title "ShipNode v$$VERSION" \
56+
--notes "Release v$$VERSION" \
57+
--verify-tag; \
58+
\
59+
echo "✓ Release v$$VERSION created successfully!"

0 commit comments

Comments
 (0)