ci: auto-tag and release on main push #23
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| packages: write | |
| concurrency: | |
| group: release-${{ github.ref_name }} | |
| cancel-in-progress: false | |
| jobs: | |
| build-release: | |
| runs-on: ubuntu-22.04 | |
| timeout-minutes: 30 | |
| env: | |
| TURBO_TELEMETRY_DISABLED: 1 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Rust build artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| apps/desktop/src-tauri/target/ | |
| key: rust-release-${{ runner.os }}-${{ hashFiles('apps/desktop/src-tauri/Cargo.lock') }} | |
| restore-keys: | | |
| rust-release-${{ runner.os }}- | |
| - name: Install Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libgtk-3-dev \ | |
| libwebkit2gtk-4.1-dev \ | |
| libjavascriptcoregtk-4.1-dev \ | |
| libayatana-appindicator3-dev \ | |
| librsvg2-dev \ | |
| libfuse2 | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate Prisma client | |
| run: pnpm --filter @openlinear/db db:generate | |
| - name: Build desktop | |
| run: pnpm build:desktop | |
| - name: Strip bundled Wayland libs from AppImage | |
| run: | | |
| set -euo pipefail | |
| APPIMAGE=$(ls apps/desktop/src-tauri/target/release/bundle/appimage/*.AppImage | head -n 1) | |
| chmod +x "$APPIMAGE" | |
| "$APPIMAGE" --appimage-extract | |
| rm -f squashfs-root/usr/lib/libwayland-client.so* | |
| rm -f squashfs-root/usr/lib/libwayland-egl.so* | |
| rm -f squashfs-root/usr/lib/libwayland-cursor.so* | |
| wget -q "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage" -O appimagetool | |
| chmod +x appimagetool | |
| ARCH=x86_64 ./appimagetool --appimage-extract-and-run squashfs-root "$APPIMAGE" | |
| - name: Prepare release artifacts | |
| run: | | |
| set -euo pipefail | |
| VERSION=${GITHUB_REF_NAME#v} | |
| APPIMAGE=$(ls apps/desktop/src-tauri/target/release/bundle/appimage/*.AppImage | head -n 1) | |
| DEB=$(ls apps/desktop/src-tauri/target/release/bundle/deb/*.deb | head -n 1) | |
| mkdir -p dist/release | |
| cp "$APPIMAGE" "dist/release/openlinear-${VERSION}-x86_64.AppImage" | |
| cp "$DEB" "dist/release/openlinear-${VERSION}-x86_64.deb" | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: dist/release/* | |
| publish-npm: | |
| name: Publish NPM Package | |
| needs: build-release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| permissions: | |
| id-token: write | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: pnpm | |
| - run: pnpm install --frozen-lockfile | |
| - name: Upgrade npm for OIDC Trusted Publishers support | |
| run: npm install -g npm@latest | |
| - name: Publish openlinear | |
| run: | | |
| cd packages/openlinear | |
| LOCAL_VERSION=$(node -p "require('./package.json').version") | |
| REMOTE_VERSION=$(npm view openlinear version 2>/dev/null || echo "0.0.0") | |
| if [ "$LOCAL_VERSION" = "$REMOTE_VERSION" ]; then | |
| echo "Version $LOCAL_VERSION already published, skipping" | |
| exit 0 | |
| fi | |
| npm publish --access public --provenance |