fix: update Homebrew formula SHA256 checksum for v0.1.0 #14
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: Build and Release | |
| on: | |
| push: | |
| branches: | |
| - master # Trigger on merges to master | |
| jobs: | |
| tag-and-release: | |
| name: Tag and Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| new_version: ${{ steps.create_tag.outputs.new_version }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # Need full history for versioning | |
| - name: Setup Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.21" | |
| # Extract current version and create new version tag | |
| - name: Create Tag | |
| id: create_tag | |
| run: | | |
| # Extract current version from version command | |
| CURRENT_VERSION=$(grep -o 'v[0-9]\+\.[0-9]\+\.[0-9]\+' cmd/commitron/cmd.go | head -1 | tr -d 'v') | |
| if [ -z "$CURRENT_VERSION" ]; then | |
| CURRENT_VERSION="0.1.0" # Default if no version found | |
| fi | |
| # Split the version into components | |
| IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" | |
| # Increment patch version | |
| NEW_PATCH=$((PATCH + 1)) | |
| NEW_VERSION="$MAJOR.$MINOR.$NEW_PATCH" | |
| TAG_VERSION="v$NEW_VERSION" | |
| # Set outputs for later steps | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| echo "tag_version=$TAG_VERSION" >> $GITHUB_OUTPUT | |
| # Create and push tag | |
| git config --global user.name "GitHub Actions Bot" | |
| git config --global user.email "actions@github.com" | |
| # Update version in code | |
| sed -i "s/Commitron v[0-9]\+\.[0-9]\+\.[0-9]\+/Commitron v$NEW_VERSION/g" cmd/commitron/cmd.go | |
| # Commit the version change | |
| git add cmd/commitron/cmd.go | |
| git commit -m "Bump version to $NEW_VERSION [skip ci]" | |
| # Create and push the tag | |
| git tag $TAG_VERSION | |
| git push origin $TAG_VERSION | |
| git push | |
| echo "Created and pushed tag $TAG_VERSION" | |
| build: | |
| name: Build (${{ matrix.os }}) | |
| needs: tag-and-release | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| artifact_name: commitron | |
| asset_name: commitron-linux-amd64 | |
| - os: windows-latest | |
| artifact_name: commitron.exe | |
| asset_name: commitron-windows-amd64.exe | |
| - os: macos-latest | |
| artifact_name: commitron | |
| asset_name: commitron-macos-amd64 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: v${{ needs.tag-and-release.outputs.new_version }} | |
| - name: Setup Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.21" | |
| # Build the application for the current OS/architecture | |
| - name: Build | |
| run: | | |
| go build -v -o ${{ matrix.artifact_name }} | |
| # Upload the binary as an artifact for this workflow run | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: ${{ matrix.artifact_name }} | |
| release: | |
| name: Create Release | |
| needs: [tag-and-release, build] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| ref: v${{ needs.tag-and-release.outputs.new_version }} | |
| # Download all artifacts from the build job | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v3 | |
| with: | |
| path: ./artifacts | |
| # Create a new GitHub release with the tag that triggered the workflow | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ needs.tag-and-release.outputs.new_version }} | |
| name: Release v${{ needs.tag-and-release.outputs.new_version }} | |
| files: ./artifacts/**/* | |
| draft: false | |
| prerelease: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |