Skip to content

deduplicate migrate config output; bump version to 0.22.0 (#194) #23

deduplicate migrate config output; bump version to 0.22.0 (#194)

deduplicate migrate config output; bump version to 0.22.0 (#194) #23

Workflow file for this run

name: Release
on:
push:
tags:
- 'v*'
jobs:
test:
runs-on: macos-26
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
run: sudo xcode-select -s /Applications/Xcode_26.4.app/Contents/Developer
- name: Run tests
env:
SWIFTIOMATIC_FULL_TESTS: "1"
run: swift test --disable-sandbox
build:
needs: test
runs-on: macos-26
steps:
- uses: actions/checkout@v4
- name: Select Xcode version
run: sudo xcode-select -s /Applications/Xcode_26.4.app/Contents/Developer
- name: Build release binary
run: swift build -c release --disable-sandbox
- name: Create archive
run: |
mkdir -p dist
cp .build/release/sm dist/
cd dist && tar -czvf ../sm-${{ github.ref_name }}-arm64.tar.gz *
- name: Generate SHA256
run: shasum -a 256 sm-${{ github.ref_name }}-arm64.tar.gz > sm-${{ github.ref_name }}-arm64.tar.gz.sha256
- name: Generate release notes
run: |
PREV_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | sed -n '2p')
if [ -z "$PREV_TAG" ]; then
NOTES=$(git log --pretty=format:"- %s" HEAD)
else
NOTES=$(git log --pretty=format:"- %s" ${PREV_TAG}..HEAD)
fi
echo "$NOTES" > release_notes.txt
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: |
sm-${{ github.ref_name }}-arm64.tar.gz
sm-${{ github.ref_name }}-arm64.tar.gz.sha256
body_path: release_notes.txt
update-homebrew:
needs: build
runs-on: ubuntu-latest
steps:
- name: Update Homebrew formula
env:
GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }}
run: |
TAG="${GITHUB_REF#refs/tags/}"
VERSION="${TAG#v}"
SHA=$(gh release download "$TAG" --repo "$GITHUB_REPOSITORY" --pattern "*.sha256" -O - | awk '{print $1}')
git clone "https://x-access-token:${GH_TOKEN}@github.com/toba/homebrew-tap.git" tap
cd tap
cat > Formula/sm.rb << FORMULA
class Sm < Formula
desc "AST-based Swift code analysis CLI — lint, format, and detect anti-patterns"
homepage "https://github.com/toba/swiftiomatic"
url "https://github.com/toba/swiftiomatic/releases/download/${TAG}/sm-${TAG}-arm64.tar.gz"
version "${VERSION}"
sha256 "${SHA}"
license "MIT"
depends_on :macos => :tahoe
depends_on arch: :arm64
def install
bin.install "sm"
end
test do
assert_match "AST-based", shell_output("#{bin}/sm --help")
end
end
FORMULA
sed -i 's/^ //' Formula/sm.rb
# Remove old formula if it exists
git rm -f Formula/swiftiomatic.rb 2>/dev/null || true
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add Formula/sm.rb
git commit -m "bump to ${VERSION}"
git push