chore: remove dotenv #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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| release: | |
| runs-on: macos-14 # arm64 (aarch64-apple-darwin) | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Read version from Cargo.toml | |
| id: pkg | |
| run: | | |
| NAME=$(grep '^name' Cargo.toml | head -1 | sed 's/.*= *//' | tr -d '"') | |
| VERSION=$(grep '^version' Cargo.toml | head -1 | sed 's/.*= *//' | tr -d '"') | |
| echo "name=$NAME" >> $GITHUB_OUTPUT | |
| echo "version=v$VERSION" >> $GITHUB_OUTPUT | |
| - name: Check if version tag already exists | |
| id: tag | |
| run: | | |
| VERSION=${{ steps.pkg.outputs.version }} | |
| if git rev-parse "$VERSION" >/dev/null 2>&1; then | |
| echo "⏭️ Tag $VERSION already exists — skipping release" | |
| echo "should_release=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "🆕 New version $VERSION detected — proceeding with release" | |
| echo "should_release=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Create and push git tag | |
| if: steps.tag.outputs.should_release == 'true' | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag ${{ steps.pkg.outputs.version }} | |
| git push origin ${{ steps.pkg.outputs.version }} | |
| - name: Install Rust toolchain | |
| if: steps.tag.outputs.should_release == 'true' | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build release binary | |
| if: steps.tag.outputs.should_release == 'true' | |
| run: cargo build --release | |
| - name: Package binary | |
| if: steps.tag.outputs.should_release == 'true' | |
| run: | | |
| NAME=${{ steps.pkg.outputs.name }} | |
| tar -czvf ${NAME}-aarch64-apple-darwin.tar.gz -C target/release ${NAME} | |
| - name: Upload to GitHub Release | |
| if: steps.tag.outputs.should_release == 'true' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.pkg.outputs.version }} | |
| name: Release ${{ steps.pkg.outputs.version }} | |
| files: ${{ steps.pkg.outputs.name }}-aarch64-apple-darwin.tar.gz |