chore: bump version to v3.0.1 #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 Test | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all tags and history for version detection | |
| - name: Set up Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.21' | |
| - name: Get version and commit info | |
| id: version | |
| run: | | |
| # Read version from VERSION file | |
| VERSION=$(cat VERSION) | |
| # Remove 'v' prefix if present | |
| VERSION=${VERSION#v} | |
| echo "VERSION=$VERSION" >> $GITHUB_OUTPUT | |
| # Get git commit hash | |
| GIT_COMMIT=$(git rev-parse --short HEAD) | |
| echo "GIT_COMMIT=$GIT_COMMIT" >> $GITHUB_OUTPUT | |
| # Get build date | |
| BUILD_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | |
| echo "BUILD_DATE=$BUILD_DATE" >> $GITHUB_OUTPUT | |
| echo "Using version: $VERSION" | |
| echo "Git commit: $GIT_COMMIT" | |
| echo "Build date: $BUILD_DATE" | |
| - name: Run tests | |
| run: ./build.sh test | |
| - name: Build all platforms | |
| run: | | |
| export VERSION=${{ steps.version.outputs.VERSION }} | |
| export GIT_COMMIT=${{ steps.version.outputs.GIT_COMMIT }} | |
| export BUILD_DATE=${{ steps.version.outputs.BUILD_DATE }} | |
| ./build.sh all | |
| - name: Organize binaries into versioned folders | |
| run: | | |
| VERSION=${{ steps.version.outputs.VERSION }} | |
| # Create versioned folders and move binaries | |
| for platform_dir in dist/*/; do | |
| if [ -d "$platform_dir" ] && [ "$(basename "$platform_dir")" != "releases" ]; then | |
| platform=$(basename "$platform_dir") | |
| versioned_dir="dist/${platform}-v${VERSION}" | |
| # Rename the directory to include version | |
| mv "$platform_dir" "$versioned_dir" | |
| echo "Moved $platform_dir to $versioned_dir" | |
| fi | |
| done | |
| # List the final structure | |
| echo "Final directory structure:" | |
| ls -la dist/ | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: spdeploy-v${{ steps.version.outputs.VERSION }}-binaries | |
| path: dist/*-v${{ steps.version.outputs.VERSION }}/ | |
| retention-days: 7 |