name: Release on: push: tags: - 'v*' jobs: release: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v4 - name: Setup Deno uses: denoland/setup-deno@v1 with: deno-version: v1.x - name: Verify version matches tag run: | TAG_VERSION=${GITHUB_REF#refs/tags/v} DENO_VERSION=$(grep '"version"' deno.json | head -1 | sed 's/.*"version": "\(.*\)".*/\1/') echo "Git tag version: $TAG_VERSION" echo "deno.json version: $DENO_VERSION" if [ "$TAG_VERSION" != "$DENO_VERSION" ]; then echo "❌ Version mismatch!" echo "Git tag: v$TAG_VERSION" echo "deno.json: $DENO_VERSION" exit 1 fi echo "✅ Versions match: $TAG_VERSION" - name: Cache dependencies uses: actions/cache@v4 with: path: ~/.cache/deno key: deno-${{ hashFiles('deno.lock') }} - name: Install dependencies run: deno cache --reload mod.ts - name: Run tests run: deno task test - name: Compile binaries run: | bash scripts/compile-all.sh - name: Generate checksums run: | cd dist/binaries sha256sum * > checksums.txt cat checksums.txt - name: Extract changelog id: changelog run: | TAG_VERSION=${GITHUB_REF#refs/tags/v} # Extract changelog section for this version CHANGELOG=$(awk "/## \[$TAG_VERSION\]/,/## \[/" changelog.md | sed '1d;$d') if [ -z "$CHANGELOG" ]; then echo "No changelog entry found for version $TAG_VERSION" CHANGELOG="Release version $TAG_VERSION" fi # Save to file for release notes echo "$CHANGELOG" > /tmp/release-notes.md cat /tmp/release-notes.md - name: Create Release uses: actions/create-release@v1 id: create_release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref_name }} body_path: /tmp/release-notes.md draft: false prerelease: false - name: Upload Linux x64 Binary uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./dist/binaries/isocreator-linux-x64 asset_name: isocreator-linux-x64 asset_content_type: application/octet-stream - name: Upload Linux ARM64 Binary uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./dist/binaries/isocreator-linux-arm64 asset_name: isocreator-linux-arm64 asset_content_type: application/octet-stream - name: Upload macOS x64 Binary uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./dist/binaries/isocreator-macos-x64 asset_name: isocreator-macos-x64 asset_content_type: application/octet-stream - name: Upload macOS ARM64 Binary uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./dist/binaries/isocreator-macos-arm64 asset_name: isocreator-macos-arm64 asset_content_type: application/octet-stream - name: Upload Windows x64 Binary uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./dist/binaries/isocreator-windows-x64.exe asset_name: isocreator-windows-x64.exe asset_content_type: application/octet-stream - name: Upload Checksums uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create_release.outputs.upload_url }} asset_path: ./dist/binaries/checksums.txt asset_name: checksums.txt asset_content_type: text/plain - name: Clean old releases run: | echo "Keeping only the last 3 releases..." # This would require gitea API calls - implement if needed