Update release script to use signed tags for version releases #2
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*' # Triggers on any tag starting with 'v' | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch full history for release notes | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.25' | |
| - name: Download dependencies | |
| run: | | |
| go mod download | |
| go mod tidy | |
| - name: Extract version from tag | |
| id: version | |
| run: | | |
| # Remove 'v' prefix from tag name | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "tag=$GITHUB_REF_NAME" >> $GITHUB_OUTPUT | |
| - name: Build binaries | |
| run: | | |
| # Set version for build | |
| export VERSION=${{ steps.version.outputs.version }} | |
| make build-all | |
| - name: Create checksums | |
| run: | | |
| cd build | |
| sha256sum pctl-* > checksums.txt | |
| cat checksums.txt | |
| - name: Generate release notes | |
| id: release_notes | |
| run: | | |
| # Get the previous tag for changelog | |
| PREVIOUS_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "") | |
| if [ -n "$PREVIOUS_TAG" ]; then | |
| echo "Generating release notes from $PREVIOUS_TAG to ${{ steps.version.outputs.tag }}" | |
| echo "## What's Changed" > release_notes.md | |
| echo "" >> release_notes.md | |
| # Get commits between tags | |
| git log --pretty=format:"- %s (%h)" $PREVIOUS_TAG..HEAD >> release_notes.md | |
| echo "" >> release_notes.md | |
| echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/$PREVIOUS_TAG...${{ steps.version.outputs.tag }}" >> release_notes.md | |
| else | |
| echo "No previous tag found, creating initial release notes" | |
| echo "## Initial Release" > release_notes.md | |
| echo "" >> release_notes.md | |
| echo "First release of pctl - Dev Companion for Portainer" >> release_notes.md | |
| fi | |
| # Add installation instructions | |
| cat >> release_notes.md << 'EOF' | |
| ## Installation | |
| Download the appropriate binary for your platform: | |
| ### Linux | |
| ```bash | |
| # AMD64 | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/pctl-${{ steps.version.outputs.version }}-linux-amd64 | |
| chmod +x pctl-${{ steps.version.outputs.version }}-linux-amd64 | |
| sudo mv pctl-${{ steps.version.outputs.version }}-linux-amd64 /usr/local/bin/pctl | |
| # ARM64 | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/pctl-${{ steps.version.outputs.version }}-linux-arm64 | |
| chmod +x pctl-${{ steps.version.outputs.version }}-linux-arm64 | |
| sudo mv pctl-${{ steps.version.outputs.version }}-linux-arm64 /usr/local/bin/pctl | |
| ``` | |
| ### macOS | |
| ```bash | |
| # AMD64 | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/pctl-${{ steps.version.outputs.version }}-darwin-amd64 | |
| chmod +x pctl-${{ steps.version.outputs.version }}-darwin-amd64 | |
| sudo mv pctl-${{ steps.version.outputs.version }}-darwin-amd64 /usr/local/bin/pctl | |
| # ARM64 (Apple Silicon) | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/pctl-${{ steps.version.outputs.version }}-darwin-arm64 | |
| chmod +x pctl-${{ steps.version.outputs.version }}-darwin-arm64 | |
| sudo mv pctl-${{ steps.version.outputs.version }}-darwin-arm64 /usr/local/bin/pctl | |
| ``` | |
| ### Windows | |
| ```bash | |
| # AMD64 | |
| wget https://github.com/${{ github.repository }}/releases/download/${{ steps.version.outputs.tag }}/pctl-${{ steps.version.outputs.version }}-windows-amd64.exe | |
| # Move pctl-${{ steps.version.outputs.version }}-windows-amd64.exe to your PATH and rename to pctl.exe | |
| ``` | |
| ### Verify Installation | |
| ```bash | |
| pctl version | |
| ``` | |
| EOF | |
| # Output the release notes | |
| cat release_notes.md | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| name: Release ${{ steps.version.outputs.tag }} | |
| body_path: release_notes.md | |
| files: | | |
| build/pctl-* | |
| build/checksums.txt | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |