feat: Aggiungi implementazione di un orologio terminale con funzioni … #10
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 | |
| # Trigger only on tags v*.*.* on main branch | |
| on: | |
| push: | |
| tags: | |
| - "v*.*.*" | |
| env: | |
| ZIG_VERSION: "0.14.0" | |
| jobs: | |
| # Single job to build for all platforms and create release | |
| release: | |
| name: Build and Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup Zig | |
| uses: goto-bus-stop/setup-zig@v2 | |
| with: | |
| version: ${{ env.ZIG_VERSION }} | |
| - name: Extract version from tag | |
| id: version | |
| shell: bash | |
| run: | | |
| TAG_NAME=${GITHUB_REF#refs/tags/} | |
| VERSION=${TAG_NAME#v} | |
| echo "tag_name=$TAG_NAME" >> $GITHUB_OUTPUT | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Building version: $VERSION" | |
| - name: Create artifacts directory | |
| shell: bash | |
| run: mkdir -p artifacts | |
| - name: Build for all platforms | |
| shell: bash | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| # All target platforms | |
| TARGETS=( | |
| "x86_64-linux-gnu" | |
| "x86_64-linux-musl" | |
| "aarch64-linux-gnu" | |
| "x86_64-windows-gnu" | |
| "x86_64-windows-msvc" | |
| "aarch64-windows-gnu" | |
| "x86_64-macos-none" | |
| "aarch64-macos-none" | |
| ) | |
| for target in "${TARGETS[@]}"; do | |
| echo "Building for $target..." | |
| # Clean previous build | |
| rm -rf zig-out | |
| # Build for target | |
| if zig build -Dtarget="$target" -Doptimize=ReleaseFast; then | |
| # Determine binary name and archive type | |
| if [[ $target == *"windows"* ]]; then | |
| binary="ziglets.exe" | |
| archive="ziglets-$VERSION-$target.zip" | |
| cd zig-out/bin && zip -9 "../../artifacts/$archive" "$binary" && cd ../.. | |
| else | |
| binary="ziglets" | |
| archive="ziglets-$VERSION-$target.tar.gz" | |
| cd zig-out/bin && tar -czf "../../artifacts/$archive" "$binary" && cd ../.. | |
| fi | |
| echo "✅ Built $target -> $archive" | |
| else | |
| echo "❌ Failed to build $target" | |
| fi | |
| done | |
| - name: Create checksums | |
| shell: bash | |
| run: | | |
| cd artifacts | |
| sha256sum *.tar.gz *.zip > checksums.txt | |
| ls -la | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.version.outputs.tag_name }} | |
| name: "Ziglets ${{ steps.version.outputs.version }}" | |
| files: artifacts/* | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |