fix: add proper version #5
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.23' | |
| - name: Get version | |
| id: version | |
| run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
| - name: Build all platforms | |
| run: | | |
| VERSION=${{ steps.version.outputs.VERSION }} make build-all | |
| - name: Create checksums | |
| run: | | |
| cd build | |
| sha256sum * > checksums.txt | |
| cat checksums.txt | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| if [ -f CHANGELOG.md ]; then | |
| # Extract changes for this version from CHANGELOG.md | |
| awk '/^## \[?'${{ steps.version.outputs.VERSION }}'\]?/{flag=1;next}/^## /{flag=0}flag' CHANGELOG.md > current_changes.txt | |
| else | |
| # Fallback: use git log since last tag | |
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| if [ -n "$PREVIOUS_TAG" ]; then | |
| git log --pretty=format:"- %s" $PREVIOUS_TAG..HEAD > current_changes.txt | |
| else | |
| echo "- Initial release" > current_changes.txt | |
| fi | |
| fi | |
| # Prepare release body | |
| echo "## What's Changed" > release_body.txt | |
| cat current_changes.txt >> release_body.txt | |
| echo "" >> release_body.txt | |
| echo "## Installation" >> release_body.txt | |
| echo "" >> release_body.txt | |
| echo "### Quick Install (Linux/macOS)" >> release_body.txt | |
| echo '```bash' >> release_body.txt | |
| echo 'curl -sSfL https://raw.githubusercontent.com/n1rna/ee-cli/main/install.sh | sh' >> release_body.txt | |
| echo '```' >> release_body.txt | |
| echo "" >> release_body.txt | |
| echo "### Manual Download" >> release_body.txt | |
| echo "Download the appropriate binary for your platform from the assets below." >> release_body.txt | |
| echo "" >> release_body.txt | |
| echo "## Checksums" >> release_body.txt | |
| echo '```' >> release_body.txt | |
| cat build/checksums.txt >> release_body.txt | |
| echo '```' >> release_body.txt | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| name: Release v${{ steps.version.outputs.VERSION }} | |
| body_path: release_body.txt | |
| files: | | |
| build/ee-linux-amd64 | |
| build/ee-windows-amd64.exe | |
| build/ee-darwin-amd64 | |
| build/checksums.txt | |
| draft: false | |
| prerelease: ${{ contains(steps.version.outputs.VERSION, '-') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Update installation script | |
| run: | | |
| # Update the version in install.sh if it exists | |
| if [ -f install.sh ]; then | |
| sed -i 's/VERSION=".*"/VERSION="v${{ steps.version.outputs.VERSION }}"/' install.sh | |
| git config user.name github-actions | |
| git config user.email github-actions@github.com | |
| git add install.sh | |
| git commit -m "Update install script to v${{ steps.version.outputs.VERSION }}" || exit 0 | |
| git push || exit 0 | |
| fi |