fix: persist navigation state (#362) #198
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: Publish Release | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "apps/array/**" | |
| - "packages/agent/**" | |
| - "pnpm-lock.yaml" | |
| - "package.json" | |
| - "turbo.json" | |
| - ".github/workflows/release.yml" | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release | |
| cancel-in-progress: true | |
| jobs: | |
| publish: | |
| runs-on: macos-latest | |
| env: | |
| GH_TOKEN: ${{ secrets.POSTHOG_BOT_PAT }} | |
| GITHUB_TOKEN: ${{ secrets.POSTHOG_BOT_PAT }} | |
| NODE_ENV: production | |
| APPLE_CODESIGN_IDENTITY: ${{ secrets.APPLE_CODESIGN_IDENTITY }} | |
| APPLE_ID: ${{ secrets.APPLE_ID }} | |
| APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
| APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
| APPLE_CODESIGN_CERT_BASE64: ${{ secrets.APPLE_CODESIGN_CERT_BASE64 }} | |
| APPLE_CODESIGN_CERT_PASSWORD: ${{ secrets.APPLE_CODESIGN_CERT_PASSWORD }} | |
| APPLE_CODESIGN_KEYCHAIN_PASSWORD: ${{ secrets.APPLE_CODESIGN_KEYCHAIN_PASSWORD }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.POSTHOG_BOT_PAT }} | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: "pnpm" | |
| - name: Bump minor version | |
| id: version | |
| run: | | |
| CURRENT_VERSION=$(jq -r .version apps/array/package.json) | |
| MAJOR=$(echo "$CURRENT_VERSION" | cut -d. -f1) | |
| MINOR=$(echo "$CURRENT_VERSION" | cut -d. -f2) | |
| NEW_VERSION="${MAJOR}.$((MINOR + 1)).0" | |
| echo "Bumping version from $CURRENT_VERSION to $NEW_VERSION" | |
| jq --arg v "$NEW_VERSION" '.version = $v' apps/array/package.json > tmp.json && mv tmp.json apps/array/package.json | |
| git config user.name "posthog-bot" | |
| git config user.email "[email protected]" | |
| git add apps/array/package.json | |
| git commit -m "chore: bump version to $NEW_VERSION [skip ci]" | |
| git push | |
| echo "version=$NEW_VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Build agent package | |
| run: pnpm --filter @posthog/agent run build | |
| - name: Import code signing certificate | |
| if: env.APPLE_CODESIGN_IDENTITY != '' | |
| env: | |
| CERT_BASE64: ${{ env.APPLE_CODESIGN_CERT_BASE64 }} | |
| CERT_PASSWORD: ${{ env.APPLE_CODESIGN_CERT_PASSWORD }} | |
| KEYCHAIN_PASSWORD: ${{ env.APPLE_CODESIGN_KEYCHAIN_PASSWORD }} | |
| run: | | |
| if [ -z "$CERT_BASE64" ] || [ -z "$CERT_PASSWORD" ] || [ -z "$KEYCHAIN_PASSWORD" ]; then | |
| echo "Missing code signing certificate secrets" | |
| exit 1 | |
| fi | |
| KEYCHAIN="$RUNNER_TEMP/codesign.keychain-db" | |
| echo "$CERT_BASE64" | base64 --decode > "$RUNNER_TEMP/certificate.p12" | |
| security create-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN" | |
| security set-keychain-settings -lut 21600 "$KEYCHAIN" | |
| security unlock-keychain -p "$KEYCHAIN_PASSWORD" "$KEYCHAIN" | |
| security import "$RUNNER_TEMP/certificate.p12" -k "$KEYCHAIN" -P "$CERT_PASSWORD" -T /usr/bin/codesign -T /usr/bin/security | |
| security list-keychains -d user -s "$KEYCHAIN" $(security list-keychains -d user | tr -d '"') | |
| security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$KEYCHAIN_PASSWORD" "$KEYCHAIN" | |
| rm "$RUNNER_TEMP/certificate.p12" | |
| - name: Create tag | |
| env: | |
| APP_VERSION: ${{ steps.version.outputs.version }} | |
| run: | | |
| TAG="v$APP_VERSION" | |
| git tag -a "$TAG" -m "Release $TAG" | |
| git push https://x-access-token:${GH_TOKEN}@github.com/${{ github.repository }} "$TAG" | |
| - name: Build native modules | |
| run: pnpm --filter array run build-native | |
| - name: Publish with Electron Forge | |
| env: | |
| APP_VERSION: ${{ steps.version.outputs.version }} | |
| run: pnpm --filter array run publish |