Skip to content

feat: add table formatting and colored output support #8

feat: add table formatting and colored output support

feat: add table formatting and colored output support #8

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
jobs:
build:
strategy:
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Extract version
id: version
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update Cargo.toml version
shell: bash
run: |
sed -i.bak 's/^version = ".*"/version = "${{ steps.version.outputs.VERSION }}"/' Cargo.toml
rm -f Cargo.toml.bak
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install Linux dependencies
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Unix)
if: matrix.os != 'windows-latest'
shell: bash
run: |
cd target/${{ matrix.target }}/release
tar -czvf ../../../reminder-cli-${{ matrix.target }}.tar.gz reminder
- name: Package (Windows)
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
Compress-Archive -Path target/${{ matrix.target }}/release/reminder.exe -DestinationPath reminder-cli-${{ matrix.target }}.zip
- name: Upload artifact (Unix)
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: reminder-cli-${{ matrix.target }}
path: reminder-cli-${{ matrix.target }}.tar.gz
- name: Upload artifact (Windows)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: reminder-cli-${{ matrix.target }}
path: reminder-cli-${{ matrix.target }}.zip
release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Prepare release files
run: |
mkdir release
mv artifacts/*/*.tar.gz release/ 2>/dev/null || true
mv artifacts/*/*.zip release/ 2>/dev/null || true
cd release
for f in *.tar.gz *.zip; do
[ -f "$f" ] && shasum -a 256 "$f" >> checksums.txt
done
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
release/*.tar.gz
release/*.zip
release/checksums.txt
generate_release_notes: true
update-homebrew:
needs: release
runs-on: ubuntu-latest
steps:
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Download checksums
run: |
curl -L -o checksums.txt "https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.VERSION }}/checksums.txt"
cat checksums.txt
- name: Parse checksums
id: checksums
run: |
echo "SHA_AARCH64_DARWIN=$(grep aarch64-apple-darwin checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "SHA_X86_64_DARWIN=$(grep x86_64-apple-darwin checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
echo "SHA_X86_64_LINUX=$(grep x86_64-unknown-linux-gnu checksums.txt | awk '{print $1}')" >> $GITHUB_OUTPUT
- name: Checkout homebrew-tap
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/homebrew-tap
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
path: homebrew-tap
- name: Update formula
run: |
cat > homebrew-tap/Formula/reminder-cli.rb << 'EOF'
class ReminderCli < Formula
desc "A CLI reminder tool with cron support and system notifications"
homepage "https://github.com/${{ github.repository }}"
version "${{ steps.version.outputs.VERSION }}"
license "MIT"
on_macos do
if Hardware::CPU.arm?
url "https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.VERSION }}/reminder-cli-aarch64-apple-darwin.tar.gz"
sha256 "${{ steps.checksums.outputs.SHA_AARCH64_DARWIN }}"
else
url "https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.VERSION }}/reminder-cli-x86_64-apple-darwin.tar.gz"
sha256 "${{ steps.checksums.outputs.SHA_X86_64_DARWIN }}"
end
end
on_linux do
url "https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.VERSION }}/reminder-cli-x86_64-unknown-linux-gnu.tar.gz"
sha256 "${{ steps.checksums.outputs.SHA_X86_64_LINUX }}"
end
def install
bin.install "reminder"
end
test do
system "#{bin}/reminder", "--help"
end
end
EOF
- name: Commit and push
run: |
cd homebrew-tap
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/reminder-cli.rb
git commit -m "Update reminder-cli to v${{ steps.version.outputs.VERSION }}"
git push
publish-crates:
needs: release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Extract version
id: version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Update Cargo.toml version
run: sed -i 's/^version = ".*"/version = "${{ steps.version.outputs.VERSION }}"/' Cargo.toml
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev
- name: Publish to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}