File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44 push :
55 tags :
66 - ' v*'
7+ branches :
8+ - main
79 workflow_dispatch :
810 inputs :
911 version :
6365 run : |
6466 if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
6567 echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT
68+ elif [ "${{ github.ref }}" == "refs/heads/main" ]; then
69+ if [ ! -f package.json ]; then
70+ echo "Error: package.json not found"
71+ exit 1
72+ fi
73+ VERSION="v$(node -p "require('./package.json').version" 2>/dev/null)"
74+ if [ -z "$VERSION" ] || [ "$VERSION" = "v" ] || [ "$VERSION" = "vundefined" ] || [ "$VERSION" = "vnull" ]; then
75+ echo "Error: Unable to extract valid version from package.json"
76+ exit 1
77+ fi
78+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
6679 else
6780 echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
6881 fi
7790
7891 - name : Create Release
7992 uses : softprops/action-gh-release@v1
80- if : startsWith(github.ref, 'refs/tags/')
93+ if : startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
8194 with :
95+ tag_name : ${{ steps.get_version.outputs.VERSION }}
8296 files : |
8397 release/**/*.exe
8498 release/**/*.dmg
Original file line number Diff line number Diff line change @@ -123,6 +123,7 @@ This project includes comprehensive CI/CD workflows using GitHub Actions:
123123
124124- ** Release** (` release.yml ` ) - Automated releases
125125 - Triggers on version tags (e.g., ` v1.0.0 ` )
126+ - Triggers on pushes to main branch (auto-creates release with package.json version)
126127 - Builds for all platforms (Windows, macOS, Linux)
127128 - Creates GitHub releases with binaries
128129 - Manual trigger option available
@@ -140,8 +141,14 @@ This project includes comprehensive CI/CD workflows using GitHub Actions:
140141
141142### Creating a Release
142143
143- To create a new release :
144+ Releases are automatically created in two ways :
144145
146+ ** 1. Automatic release on main branch**
147+ - Every push to the main branch automatically creates a release
148+ - Uses the version from ` package.json ` (e.g., if package.json has "version": "1.0.0", it creates release v1.0.0)
149+ - Builds and publishes binaries for all platforms
150+
151+ ** 2. Manual release with version tag**
145152``` bash
146153# Create and push a version tag
147154git tag v1.0.0
You can’t perform that action at this time.
0 commit comments