ok #12
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
| # This workflow will build a golang project | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
| name: Go | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| tags: [ "v*" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.2' | |
| - name: Test | |
| run: go test -v ./... | |
| build: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| goos: [linux, windows, darwin] | |
| goarch: [amd64, arm64] | |
| exclude: | |
| - goos: windows | |
| goarch: arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24.2' | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| BINARY_NAME=gomail | |
| if [ "$GOOS" = "windows" ]; then | |
| BINARY_NAME="${BINARY_NAME}.exe" | |
| fi | |
| OUTPUT_NAME="${BINARY_NAME}_${GOOS}_${GOARCH}" | |
| if [ "$GOOS" = "windows" ]; then | |
| OUTPUT_NAME="${OUTPUT_NAME}.exe" | |
| fi | |
| go build -v -ldflags="-s -w" -o "$OUTPUT_NAME" . | |
| # Create archive | |
| if [ "$GOOS" = "windows" ]; then | |
| zip "${OUTPUT_NAME%.exe}.zip" "$OUTPUT_NAME" | |
| else | |
| tar -czf "${OUTPUT_NAME}.tar.gz" "$OUTPUT_NAME" | |
| fi | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: gomail-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: | | |
| *.zip | |
| *.tar.gz | |
| release: | |
| if: (github.ref == 'refs/heads/main' && github.event_name == 'push') || startsWith(github.ref, 'refs/tags/') | |
| needs: build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Generate version | |
| id: version | |
| run: | | |
| # Check if workflow was triggered by a tag | |
| if [[ $GITHUB_REF == refs/tags/* ]]; then | |
| # Use the tag name directly | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| echo "Using tag: $VERSION" | |
| else | |
| # Generate version based on date and short commit hash | |
| DATE=$(date +'%Y%m%d') | |
| SHORT_SHA=${GITHUB_SHA::7} | |
| VERSION="v${DATE}-${SHORT_SHA}" | |
| fi | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "tag=${VERSION}" >> $GITHUB_OUTPUT | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: List downloaded files | |
| run: | | |
| echo "Files in current directory:" | |
| ls -la | |
| echo "Archive files:" | |
| find . -name "*.zip" -o -name "*.tar.gz" | sort | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag }} | |
| files: | | |
| gomail_linux_amd64.tar.gz | |
| gomail_linux_arm64.tar.gz | |
| gomail_darwin_amd64.tar.gz | |
| gomail_darwin_arm64.tar.gz | |
| gomail.exe_windows_amd64.zip | |
| draft: false | |
| prerelease: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
| generate_release_notes: true | |
| name: GoMail ${{ steps.version.outputs.version }} ${{ startsWith(github.ref, 'refs/tags/') && '' || '(Pre-release)' }} | |
| body: | | |
| ## GoMail ${{ steps.version.outputs.version }} ${{ startsWith(github.ref, 'refs/tags/') && '' || '- Pre-release Build' }} | |
| **Commit:** ${{ github.sha }} | |
| **Build Date:** $(date +'%Y-%m-%d %H:%M:%S UTC') | |
| Terminal-based email client built with Go and Bubble Tea. | |
| ### Downloads | |
| **Linux:** | |
| - `gomail_linux_amd64.tar.gz` - Linux x64 | |
| - `gomail_linux_arm64.tar.gz` - Linux ARM64 | |
| **macOS:** | |
| - `gomail_darwin_amd64.tar.gz` - macOS Intel | |
| - `gomail_darwin_arm64.tar.gz` - macOS Apple Silicon | |
| **Windows:** | |
| - `gomail_windows_amd64.zip` - Windows x64 | |
| ### Installation | |
| 1. Download the appropriate archive for your platform | |
| 2. Extract the binary | |
| 3. Run `./gomail` (or `gomail.exe` on Windows) | |
| ${{ startsWith(github.ref, 'refs/tags/') && '' || '**Note:** Pre-release builds may contain experimental features and bugs. Use stable releases for production.' }} | |
| Send emails from your terminal! � | |