Fix CSS #154
This file contains 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: Build and Create DMG | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
pull_request: | |
branches: | |
- main | |
- dev | |
jobs: | |
build: | |
runs-on: macos-latest | |
outputs: | |
version: ${{ env.VERSION }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Set up Bun | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- name: Install Dependencies | |
run: bun install | |
continue-on-error: false | |
- name: Install create-dmg | |
run: | | |
brew update | |
brew install create-dmg | |
continue-on-error: false | |
- name: Build and package app | |
run: bun run release | |
continue-on-error: false | |
- name: Get version from package.json | |
id: get_version | |
run: | | |
if [ -f "package.json" ]; then | |
echo "VERSION=$(jq -r .version package.json)" >> $GITHUB_ENV | |
else | |
echo "Error: package.json not found" | |
exit 1 | |
fi | |
- name: Verify DMG files exist | |
run: | | |
for arch in x64 universal arm64; do | |
if [ ! -f "dist/AppleBlox-${VERSION}_${arch}.dmg" ]; then | |
echo "Error: DMG file for ${arch} not found" | |
exit 1 | |
fi | |
done | |
- name: Upload (mac_x64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AppleBlox-${{ env.VERSION }}_x64.dmg | |
path: dist/AppleBlox-${{ env.VERSION }}_x64.dmg | |
if-no-files-found: error | |
retention-days: 30 | |
- name: Upload (mac_universal) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AppleBlox-${{ env.VERSION }}_universal.dmg | |
path: dist/AppleBlox-${{ env.VERSION }}_universal.dmg | |
if-no-files-found: error | |
retention-days: 30 | |
- name: Upload (mac_arm64) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: AppleBlox-${{ env.VERSION }}_arm64.dmg | |
path: dist/AppleBlox-${{ env.VERSION }}_arm64.dmg | |
if-no-files-found: error | |
retention-days: 30 | |
- name: Build Summary | |
if: always() | |
run: | | |
echo "### Build Results 📦" >> $GITHUB_STEP_SUMMARY | |
echo "Version: ${{ env.VERSION }}" >> $GITHUB_STEP_SUMMARY | |
echo "- x64 DMG: $(ls -lh dist/AppleBlox-${VERSION}_x64.dmg 2>/dev/null || echo 'Not built')" >> $GITHUB_STEP_SUMMARY | |
echo "- Universal DMG: $(ls -lh dist/AppleBlox-${VERSION}_universal.dmg 2>/dev/null || echo 'Not built')" >> $GITHUB_STEP_SUMMARY | |
echo "- ARM64 DMG: $(ls -lh dist/AppleBlox-${VERSION}_arm64.dmg 2>/dev/null || echo 'Not built')" >> $GITHUB_STEP_SUMMARY | |
create-release: | |
needs: build | |
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # This ensures we fetch all history and tags | |
- name: Get previous tag | |
run: | | |
echo "PREVIOUS_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo '')" >> $GITHUB_ENV | |
- name: Generate commit history | |
run: | | |
if [ -n "${{ env.PREVIOUS_TAG }}" ]; then | |
echo "### Commits since ${{ env.PREVIOUS_TAG }}" > CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
git log --pretty=format:"- [%h](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/%H) %s" ${{ env.PREVIOUS_TAG }}..HEAD >> CHANGELOG.md | |
else | |
echo "### Initial Release" > CHANGELOG.md | |
echo "" >> CHANGELOG.md | |
git log --pretty=format:"- [%h](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/%H) %s" >> CHANGELOG.md | |
fi | |
- name: Download all artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: ./artifacts | |
- name: Create Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: Release ${{ needs.build.outputs.version }} | |
tag_name: ${{ needs.build.outputs.version }} | |
draft: true | |
files: | | |
./artifacts/AppleBlox-*/*.dmg | |
generate_release_notes: true | |
body_path: CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |