diff --git a/packages/create-twenty-app/src/constants/template/github/actions/deploy/action.yml b/packages/create-twenty-app/src/constants/template/github/actions/deploy/action.yml new file mode 100644 index 0000000000..371d202f2e --- /dev/null +++ b/packages/create-twenty-app/src/constants/template/github/actions/deploy/action.yml @@ -0,0 +1,46 @@ +name: Deploy Twenty App +description: Build and deploy a Twenty app to a remote instance + +inputs: + api-url: + description: Base URL of the target Twenty instance (e.g. https://my.twenty.instance) + required: true + api-key: + description: API key or access token for the target instance + required: true + +runs: + using: composite + steps: + - name: Enable Corepack + shell: bash + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + + - name: Install dependencies + shell: bash + run: yarn install --immutable + + - name: Configure remote + shell: bash + run: | + mkdir -p ~/.twenty + node -e " + const fs = require('fs'), path = require('path'), os = require('os'); + fs.writeFileSync(path.join(os.homedir(), '.twenty', 'config.json'), JSON.stringify({ + version: 1, + remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY } } + }, null, 2)); + " + env: + API_URL: ${{ inputs.api-url }} + API_KEY: ${{ inputs.api-key }} + + - name: Deploy + shell: bash + run: yarn twenty deploy --remote target diff --git a/packages/create-twenty-app/src/constants/template/github/actions/install/action.yml b/packages/create-twenty-app/src/constants/template/github/actions/install/action.yml new file mode 100644 index 0000000000..3f7ef535cf --- /dev/null +++ b/packages/create-twenty-app/src/constants/template/github/actions/install/action.yml @@ -0,0 +1,46 @@ +name: Install Twenty App +description: Install (or upgrade) a Twenty app on a specific workspace + +inputs: + api-url: + description: Base URL of the target Twenty instance (e.g. https://my.twenty.instance) + required: true + api-key: + description: API key or access token for the target workspace + required: true + +runs: + using: composite + steps: + - name: Enable Corepack + shell: bash + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + + - name: Install dependencies + shell: bash + run: yarn install --immutable + + - name: Configure remote + shell: bash + run: | + mkdir -p ~/.twenty + node -e " + const fs = require('fs'), path = require('path'), os = require('os'); + fs.writeFileSync(path.join(os.homedir(), '.twenty', 'config.json'), JSON.stringify({ + version: 1, + remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY } } + }, null, 2)); + " + env: + API_URL: ${{ inputs.api-url }} + API_KEY: ${{ inputs.api-key }} + + - name: Install + shell: bash + run: yarn twenty install --remote target diff --git a/packages/create-twenty-app/src/constants/template/github/workflows/cd.yml b/packages/create-twenty-app/src/constants/template/github/workflows/cd.yml new file mode 100644 index 0000000000..909916ed06 --- /dev/null +++ b/packages/create-twenty-app/src/constants/template/github/workflows/cd.yml @@ -0,0 +1,42 @@ +name: CD + +on: + push: + branches: + - main + pull_request: + types: [labeled] + +permissions: + contents: read + +env: + TWENTY_DEPLOY_URL: http://localhost:3000 + +concurrency: + group: cd-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy-and-install: + if: >- + github.event_name == 'push' || + (github.event_name == 'pull_request' && github.event.label.name == 'deploy') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + + - name: Deploy + uses: ./.github/actions/deploy + with: + api-url: ${{ env.TWENTY_DEPLOY_URL }} + api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }} + + - name: Install + uses: ./.github/actions/install + with: + api-url: ${{ env.TWENTY_DEPLOY_URL }} + api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }} diff --git a/packages/create-twenty-app/src/constants/template/github/workflows/ci.yml b/packages/create-twenty-app/src/constants/template/github/workflows/ci.yml index b98f6a64e5..9112ecb495 100644 --- a/packages/create-twenty-app/src/constants/template/github/workflows/ci.yml +++ b/packages/create-twenty-app/src/constants/template/github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - name: Spawn Twenty test instance id: twenty - uses: twentyhq/twenty/.github/actions/spawn-twenty-app-dev-test@feature/sdk-config-file-source-of-truth + uses: twentyhq/twenty/.github/actions/spawn-twenty-app-dev-test@main with: twenty-version: ${{ env.TWENTY_VERSION }} diff --git a/packages/twenty-apps/examples/hello-world/.github/actions/deploy/action.yml b/packages/twenty-apps/examples/hello-world/.github/actions/deploy/action.yml new file mode 100644 index 0000000000..371d202f2e --- /dev/null +++ b/packages/twenty-apps/examples/hello-world/.github/actions/deploy/action.yml @@ -0,0 +1,46 @@ +name: Deploy Twenty App +description: Build and deploy a Twenty app to a remote instance + +inputs: + api-url: + description: Base URL of the target Twenty instance (e.g. https://my.twenty.instance) + required: true + api-key: + description: API key or access token for the target instance + required: true + +runs: + using: composite + steps: + - name: Enable Corepack + shell: bash + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + + - name: Install dependencies + shell: bash + run: yarn install --immutable + + - name: Configure remote + shell: bash + run: | + mkdir -p ~/.twenty + node -e " + const fs = require('fs'), path = require('path'), os = require('os'); + fs.writeFileSync(path.join(os.homedir(), '.twenty', 'config.json'), JSON.stringify({ + version: 1, + remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY } } + }, null, 2)); + " + env: + API_URL: ${{ inputs.api-url }} + API_KEY: ${{ inputs.api-key }} + + - name: Deploy + shell: bash + run: yarn twenty deploy --remote target diff --git a/packages/twenty-apps/examples/hello-world/.github/actions/install/action.yml b/packages/twenty-apps/examples/hello-world/.github/actions/install/action.yml new file mode 100644 index 0000000000..3f7ef535cf --- /dev/null +++ b/packages/twenty-apps/examples/hello-world/.github/actions/install/action.yml @@ -0,0 +1,46 @@ +name: Install Twenty App +description: Install (or upgrade) a Twenty app on a specific workspace + +inputs: + api-url: + description: Base URL of the target Twenty instance (e.g. https://my.twenty.instance) + required: true + api-key: + description: API key or access token for the target workspace + required: true + +runs: + using: composite + steps: + - name: Enable Corepack + shell: bash + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + + - name: Install dependencies + shell: bash + run: yarn install --immutable + + - name: Configure remote + shell: bash + run: | + mkdir -p ~/.twenty + node -e " + const fs = require('fs'), path = require('path'), os = require('os'); + fs.writeFileSync(path.join(os.homedir(), '.twenty', 'config.json'), JSON.stringify({ + version: 1, + remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY } } + }, null, 2)); + " + env: + API_URL: ${{ inputs.api-url }} + API_KEY: ${{ inputs.api-key }} + + - name: Install + shell: bash + run: yarn twenty install --remote target diff --git a/packages/twenty-apps/examples/hello-world/.github/workflows/cd.yml b/packages/twenty-apps/examples/hello-world/.github/workflows/cd.yml new file mode 100644 index 0000000000..909916ed06 --- /dev/null +++ b/packages/twenty-apps/examples/hello-world/.github/workflows/cd.yml @@ -0,0 +1,42 @@ +name: CD + +on: + push: + branches: + - main + pull_request: + types: [labeled] + +permissions: + contents: read + +env: + TWENTY_DEPLOY_URL: http://localhost:3000 + +concurrency: + group: cd-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy-and-install: + if: >- + github.event_name == 'push' || + (github.event_name == 'pull_request' && github.event.label.name == 'deploy') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + + - name: Deploy + uses: ./.github/actions/deploy + with: + api-url: ${{ env.TWENTY_DEPLOY_URL }} + api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }} + + - name: Install + uses: ./.github/actions/install + with: + api-url: ${{ env.TWENTY_DEPLOY_URL }} + api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }} diff --git a/packages/twenty-apps/examples/hello-world/.github/workflows/ci.yml b/packages/twenty-apps/examples/hello-world/.github/workflows/ci.yml index b98f6a64e5..9112ecb495 100644 --- a/packages/twenty-apps/examples/hello-world/.github/workflows/ci.yml +++ b/packages/twenty-apps/examples/hello-world/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - name: Spawn Twenty test instance id: twenty - uses: twentyhq/twenty/.github/actions/spawn-twenty-app-dev-test@feature/sdk-config-file-source-of-truth + uses: twentyhq/twenty/.github/actions/spawn-twenty-app-dev-test@main with: twenty-version: ${{ env.TWENTY_VERSION }} diff --git a/packages/twenty-apps/examples/postcard/.github/actions/deploy/action.yml b/packages/twenty-apps/examples/postcard/.github/actions/deploy/action.yml new file mode 100644 index 0000000000..371d202f2e --- /dev/null +++ b/packages/twenty-apps/examples/postcard/.github/actions/deploy/action.yml @@ -0,0 +1,46 @@ +name: Deploy Twenty App +description: Build and deploy a Twenty app to a remote instance + +inputs: + api-url: + description: Base URL of the target Twenty instance (e.g. https://my.twenty.instance) + required: true + api-key: + description: API key or access token for the target instance + required: true + +runs: + using: composite + steps: + - name: Enable Corepack + shell: bash + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + + - name: Install dependencies + shell: bash + run: yarn install --immutable + + - name: Configure remote + shell: bash + run: | + mkdir -p ~/.twenty + node -e " + const fs = require('fs'), path = require('path'), os = require('os'); + fs.writeFileSync(path.join(os.homedir(), '.twenty', 'config.json'), JSON.stringify({ + version: 1, + remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY } } + }, null, 2)); + " + env: + API_URL: ${{ inputs.api-url }} + API_KEY: ${{ inputs.api-key }} + + - name: Deploy + shell: bash + run: yarn twenty deploy --remote target diff --git a/packages/twenty-apps/examples/postcard/.github/actions/install/action.yml b/packages/twenty-apps/examples/postcard/.github/actions/install/action.yml new file mode 100644 index 0000000000..3f7ef535cf --- /dev/null +++ b/packages/twenty-apps/examples/postcard/.github/actions/install/action.yml @@ -0,0 +1,46 @@ +name: Install Twenty App +description: Install (or upgrade) a Twenty app on a specific workspace + +inputs: + api-url: + description: Base URL of the target Twenty instance (e.g. https://my.twenty.instance) + required: true + api-key: + description: API key or access token for the target workspace + required: true + +runs: + using: composite + steps: + - name: Enable Corepack + shell: bash + run: corepack enable + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version-file: '.nvmrc' + cache: yarn + + - name: Install dependencies + shell: bash + run: yarn install --immutable + + - name: Configure remote + shell: bash + run: | + mkdir -p ~/.twenty + node -e " + const fs = require('fs'), path = require('path'), os = require('os'); + fs.writeFileSync(path.join(os.homedir(), '.twenty', 'config.json'), JSON.stringify({ + version: 1, + remotes: { target: { apiUrl: process.env.API_URL, apiKey: process.env.API_KEY } } + }, null, 2)); + " + env: + API_URL: ${{ inputs.api-url }} + API_KEY: ${{ inputs.api-key }} + + - name: Install + shell: bash + run: yarn twenty install --remote target diff --git a/packages/twenty-apps/examples/postcard/.github/workflows/cd.yml b/packages/twenty-apps/examples/postcard/.github/workflows/cd.yml new file mode 100644 index 0000000000..909916ed06 --- /dev/null +++ b/packages/twenty-apps/examples/postcard/.github/workflows/cd.yml @@ -0,0 +1,42 @@ +name: CD + +on: + push: + branches: + - main + pull_request: + types: [labeled] + +permissions: + contents: read + +env: + TWENTY_DEPLOY_URL: http://localhost:3000 + +concurrency: + group: cd-${{ github.ref }} + cancel-in-progress: true + +jobs: + deploy-and-install: + if: >- + github.event_name == 'push' || + (github.event_name == 'pull_request' && github.event.label.name == 'deploy') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + + - name: Deploy + uses: ./.github/actions/deploy + with: + api-url: ${{ env.TWENTY_DEPLOY_URL }} + api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }} + + - name: Install + uses: ./.github/actions/install + with: + api-url: ${{ env.TWENTY_DEPLOY_URL }} + api-key: ${{ secrets.TWENTY_DEPLOY_API_KEY }} diff --git a/packages/twenty-apps/examples/postcard/.github/workflows/ci.yml b/packages/twenty-apps/examples/postcard/.github/workflows/ci.yml index b98f6a64e5..9112ecb495 100644 --- a/packages/twenty-apps/examples/postcard/.github/workflows/ci.yml +++ b/packages/twenty-apps/examples/postcard/.github/workflows/ci.yml @@ -25,7 +25,7 @@ jobs: - name: Spawn Twenty test instance id: twenty - uses: twentyhq/twenty/.github/actions/spawn-twenty-app-dev-test@feature/sdk-config-file-source-of-truth + uses: twentyhq/twenty/.github/actions/spawn-twenty-app-dev-test@main with: twenty-version: ${{ env.TWENTY_VERSION }}