diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 68d0221..08a805d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -51,9 +51,8 @@ jobs: uses: dtolnay/rust-toolchain@stable - name: Check if package is publishable - run: cargo publish --dry-run + run: cargo publish --dry-run --locked - name: Publish to crates.io - run: cargo publish --token ${{ secrets.CRATES_IO_TOKEN }} - + run: cargo publish --locked --token ${{ secrets.CRATES_IO_TOKEN }} diff --git a/.github/workflows/release-on-version-bump.yml b/.github/workflows/release-on-version-bump.yml new file mode 100644 index 0000000..eda8b06 --- /dev/null +++ b/.github/workflows/release-on-version-bump.yml @@ -0,0 +1,62 @@ +name: Release on Version Bump + +on: + push: + branches: + - main + paths: + - 'Cargo.toml' + +permissions: + contents: write + +jobs: + detect-version-change: + name: Detect version change + runs-on: ubuntu-latest + outputs: + changed: ${{ steps.detect.outputs.changed }} + version: ${{ steps.detect.outputs.version }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Detect version bump + id: detect + shell: bash + run: | + set -euo pipefail + CURRENT_VERSION=$(grep '^version\s*=\s*"' Cargo.toml | head -n1 | cut -d '"' -f 2) + echo "Current: $CURRENT_VERSION" + + if git rev-parse HEAD~1 >/dev/null 2>&1; then + PREV_VERSION=$(git show HEAD~1:Cargo.toml | grep '^version\s*=\s*"' | head -n1 | cut -d '"' -f 2 || true) + else + PREV_VERSION="" + fi + echo "Previous: ${PREV_VERSION:-}" + + if [ "$CURRENT_VERSION" != "$PREV_VERSION" ] && [ -n "$CURRENT_VERSION" ]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT" + else + echo "changed=false" >> "$GITHUB_OUTPUT" + fi + + create-release: + name: Create GitHub release + needs: detect-version-change + if: needs.detect-version-change.outputs.changed == 'true' + runs-on: ubuntu-latest + steps: + - name: Create/Update release v${{ needs.detect-version-change.outputs.version }} + uses: ncipollo/release-action@v1 + with: + tag: v${{ needs.detect-version-change.outputs.version }} + name: v${{ needs.detect-version-change.outputs.version }} + generateReleaseNotes: true + draft: false + prerelease: false + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c20076f..a8eff8c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,22 +1,26 @@ -name: Release +name: Release Assets on: release: types: [published] +permissions: + contents: write + jobs: build-and-upload: - name: Build for ${{ matrix.os }} ${{ matrix.arch }} - runs-on: ${{ matrix.os }} + name: Build for ${{ matrix.runner }} ${{ matrix.arch }} + runs-on: ${{ matrix.runner }} strategy: matrix: include: - - os: macos-latest - target: x86_64-apple-darwin - arch: x86_64 - - os: macos-latest + - runner: macos-latest target: aarch64-apple-darwin arch: arm64 + - runner: macos-12 + target: x86_64-apple-darwin + arch: x86_64 + fail-fast: false steps: - name: Checkout code @@ -33,7 +37,7 @@ jobs: - name: Build tarts run: cargo build --release --target ${{ matrix.target }} - - name: Create archive + - name: Create archive and checksum shell: bash run: | # Standard naming convention for Homebrew: tarts-{version}-{target}.tar.gz @@ -42,10 +46,14 @@ jobs: cp target/${{ matrix.target }}/release/tarts dist/tarts tar -czvf "$ASSET_NAME" -C dist tarts echo "ASSET_NAME=$ASSET_NAME" >> $GITHUB_ENV + # Generate sha256 checksum file alongside the archive + shasum -a 256 "$ASSET_NAME" | awk '{print $1}' > "$ASSET_NAME.sha256" - name: Upload release asset uses: softprops/action-gh-release@v1 with: - files: ${{ env.ASSET_NAME }} + files: | + ${{ env.ASSET_NAME }} + ${{ env.ASSET_NAME }}.sha256 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.tmuxp.yaml b/.tmuxp.yaml index aca1e65..8832d14 100644 --- a/.tmuxp.yaml +++ b/.tmuxp.yaml @@ -7,17 +7,21 @@ windows: panes: - shell_command: - helix - - window_name: cmd + - window_name: agent start-directory: ./ panes: - shell_command: - clear - - window_name: srv + - window_name: cmd1 start-directory: ./ panes: - shell_command: - - clear - - window_name: notes + - eza --long + - window_name: cmd2 + panes: + - shell_command: + - eza --long + - window_name: files panes: - shell_command: - - emacs -nw notes.org + - yazi diff --git a/Cargo.toml b/Cargo.toml index 3371184..dc56cda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "tarts" # shortcut from Terminal Arts -version = "0.1.20" +version = "0.1.21" edition = "2024" authors = ["oiwn "]