fix: diff stats, archive action, sort worktrees, and font fixes (#101) #18
Workflow file for this run
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: Build & Publish Release | |
| on: | |
| push: | |
| branches: | |
| - 'release' | |
| - 'release/*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: macos-14 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| BUILD_SOURCEVERSION: ${{ github.sha }} | |
| strategy: | |
| matrix: | |
| arch: [arm64, x64] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: 'apps/desktop/.nvmrc' | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: Prepare node_modules cache key | |
| working-directory: apps/desktop | |
| run: mkdir -p .build && node build/azure-pipelines/common/computeNodeModulesCacheKey.ts darwin ${{ matrix.arch }} $(node -p process.arch) > .build/packagelockhash | |
| - name: Restore node_modules cache | |
| id: cache-node-modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: apps/desktop/.build/node_modules_cache | |
| key: "release-node_modules-${{ matrix.arch }}-${{ hashFiles('apps/desktop/.build/packagelockhash') }}" | |
| - name: Extract node_modules cache | |
| if: steps.cache-node-modules.outputs.cache-hit == 'true' | |
| working-directory: apps/desktop | |
| run: tar -xzf .build/node_modules_cache/cache.tgz | |
| - name: Install dependencies | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| working-directory: apps/desktop | |
| run: | | |
| for i in {1..5}; do | |
| npm ci && break | |
| if [ $i -eq 5 ]; then | |
| echo "Npm install failed too many times" >&2 | |
| exit 1 | |
| fi | |
| echo "Npm install failed $i, trying again..." | |
| done | |
| env: | |
| ELECTRON_SKIP_BINARY_DOWNLOAD: 1 | |
| PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
| - name: Create node_modules archive | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| working-directory: apps/desktop | |
| run: | | |
| node build/azure-pipelines/common/listNodeModules.ts .build/node_modules_list.txt | |
| mkdir -p .build/node_modules_cache | |
| tar -czf .build/node_modules_cache/cache.tgz --files-from .build/node_modules_list.txt | |
| - name: Download Electron | |
| working-directory: apps/desktop | |
| run: npm run electron | |
| - name: Compile for production | |
| working-directory: apps/desktop | |
| run: NODE_OPTIONS="--max-old-space-size=8192" npx gulp compile-build-without-mangling | |
| - name: Minify | |
| working-directory: apps/desktop | |
| run: npx gulp minify-vscode | |
| - name: Package Electron app | |
| working-directory: apps/desktop | |
| run: npx gulp vscode-darwin-${{ matrix.arch }}-min | |
| - name: Create DMG (for fresh installs) | |
| working-directory: apps/desktop | |
| run: | | |
| mkdir -p release-output | |
| VSCODE_ARCH=${{ matrix.arch }} VSCODE_QUALITY=stable npx tsx build/darwin/create-dmg.ts ../ release-output | |
| - name: Create update zip (for auto-update) | |
| working-directory: apps | |
| run: | | |
| cd Workstreams-darwin-${{ matrix.arch }} | |
| zip -ryq ../desktop/release-output/Workstreams-darwin-${{ matrix.arch }}.zip Workstreams.app | |
| - name: Extract version info | |
| id: version | |
| working-directory: apps/desktop | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| COMMIT=$(git rev-parse HEAD) | |
| TIMESTAMP=$(date +%s)000 | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "commit=$COMMIT" >> "$GITHUB_OUTPUT" | |
| echo "timestamp=$TIMESTAMP" >> "$GITHUB_OUTPUT" | |
| - name: Generate update manifest | |
| working-directory: apps/desktop | |
| run: | | |
| DMG_SHA256=$(shasum -a 256 release-output/Workstreams-darwin-${{ matrix.arch }}.dmg | cut -d' ' -f1) | |
| ZIP_SHA256=$(shasum -a 256 release-output/Workstreams-darwin-${{ matrix.arch }}.zip | cut -d' ' -f1) | |
| cat > release-output/update-manifest-${{ matrix.arch }}.json << EOF | |
| { | |
| "version": "${{ steps.version.outputs.commit }}", | |
| "productVersion": "${{ steps.version.outputs.version }}", | |
| "timestamp": ${{ steps.version.outputs.timestamp }}, | |
| "url": "https://github.com/${{ github.repository }}/releases/download/v${{ steps.version.outputs.version }}/Workstreams-darwin-${{ matrix.arch }}.zip", | |
| "sha256hash": "$ZIP_SHA256" | |
| } | |
| EOF | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-${{ matrix.arch }} | |
| path: apps/desktop/release-output/ | |
| publish-release: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Extract version | |
| id: version | |
| working-directory: apps/desktop | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Generate changelog | |
| run: | | |
| LAST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") | |
| if [ -n "$LAST_TAG" ]; then | |
| git log ${LAST_TAG}..HEAD --pretty=format:"- %s" > CHANGELOG.md | |
| else | |
| git log --oneline -30 --pretty=format:"- %s" > CHANGELOG.md | |
| fi | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| merge-multiple: true | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: v${{ steps.version.outputs.version }} | |
| name: Workstreams v${{ steps.version.outputs.version }} | |
| body_path: CHANGELOG.md | |
| files: | | |
| artifacts/Workstreams-darwin-arm64.dmg | |
| artifacts/Workstreams-darwin-x64.dmg | |
| artifacts/Workstreams-darwin-arm64.zip | |
| artifacts/Workstreams-darwin-x64.zip | |
| artifacts/update-manifest-arm64.json | |
| artifacts/update-manifest-x64.json |