name: Release App

on:
    workflow_dispatch:
    push:
        branches:
            - master

permissions:
    contents: write

jobs:
    release:
        runs-on: ubuntu-latest
        steps:
            - name: Checkout repository
              uses: actions/checkout@v3
              with:
                  fetch-depth: 0
                  submodules: recursive

            - name: Setup Node.js
              uses: actions/setup-node@v3
              with:
                  node-version: "22"

            - name: Install dependencies
              run: |
                  npm install
                  npm i @rollup/rollup-linux-x64-gnu
              working-directory: ./packages/app

            - name: Run release script
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              run: node scripts/release.js --ignore-commits
              working-directory: ./packages/app
