From 2375b53284299a56084742ad5e5f1ca0a0f020b2 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Fri, 23 May 2025 17:51:35 +0100 Subject: [PATCH 1/6] First GitHub action test --- .github/workflows/pr-preview.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/pr-preview.yml diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml new file mode 100644 index 0000000..01471a8 --- /dev/null +++ b/.github/workflows/pr-preview.yml @@ -0,0 +1,26 @@ +name: PR Preview Deploy + +on: + pull_request: + types: [opened, synchronize, reopened] + +jobs: + deploy-preview: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "20" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Deploy to Preview Environment + run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview + env: + TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }} From 181e4bf7a900791427d5ee0102f59544efed6b33 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Fri, 23 May 2025 17:56:42 +0100 Subject: [PATCH 2/6] =?UTF-8?q?Logout=20if=20it=E2=80=99s=20set?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-preview.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 01471a8..745e67c 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -2,7 +2,7 @@ name: PR Preview Deploy on: pull_request: - types: [opened, synchronize, reopened] + types: [opened, synchronize, reopened, closed, merged] jobs: deploy-preview: @@ -20,6 +20,15 @@ jobs: - name: Install dependencies run: npm ci + - name: Check Token Presence + run: | + if [ -n "${{ secrets.TRIGGER_ACCESS_TOKEN }}" ]; then + echo "TRIGGER_ACCESS_TOKEN is set" + else + echo "TRIGGER_ACCESS_TOKEN is not set" + exit 1 + fi + - name: Deploy to Preview Environment run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview env: From 45778db18c5fe940f94d50ac017f4a96b50105f5 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Fri, 23 May 2025 17:58:12 +0100 Subject: [PATCH 3/6] Logout the token --- .github/workflows/pr-preview.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 745e67c..70a6d49 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -21,13 +21,10 @@ jobs: run: npm ci - name: Check Token Presence + env: + TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }} run: | - if [ -n "${{ secrets.TRIGGER_ACCESS_TOKEN }}" ]; then - echo "TRIGGER_ACCESS_TOKEN is set" - else - echo "TRIGGER_ACCESS_TOKEN is not set" - exit 1 - fi + echo $TRIGGER_ACCESS_TOKEN - name: Deploy to Preview Environment run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview From afab2b9595f3a06fd1de32d6adeb84339032ebaa Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Fri, 23 May 2025 18:00:18 +0100 Subject: [PATCH 4/6] =?UTF-8?q?Set=20the=20api=20url=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pr-preview.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 70a6d49..7c06027 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -20,13 +20,7 @@ jobs: - name: Install dependencies run: npm ci - - name: Check Token Presence - env: - TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }} - run: | - echo $TRIGGER_ACCESS_TOKEN - - name: Deploy to Preview Environment - run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview + run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview -a https://matt-webapp.trigger.dev env: TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }} From 0ec666bdb9566243669844f9edcf487939262a88 Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Fri, 23 May 2025 18:02:25 +0100 Subject: [PATCH 5/6] Add self-hosted arg --- .github/workflows/pr-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 7c06027..2492192 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -21,6 +21,6 @@ jobs: run: npm ci - name: Deploy to Preview Environment - run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview -a https://matt-webapp.trigger.dev + run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview -a https://matt-webapp.trigger.dev --self-hosted --push env: TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }} From 8eaefbf03d016b48941d762a24958b69fe387c6f Mon Sep 17 00:00:00 2001 From: Matt Aitken Date: Fri, 23 May 2025 18:05:08 +0100 Subject: [PATCH 6/6] Got rid of push --- .github/workflows/pr-preview.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr-preview.yml b/.github/workflows/pr-preview.yml index 2492192..76a06c4 100644 --- a/.github/workflows/pr-preview.yml +++ b/.github/workflows/pr-preview.yml @@ -21,6 +21,6 @@ jobs: run: npm ci - name: Deploy to Preview Environment - run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview -a https://matt-webapp.trigger.dev --self-hosted --push + run: npx trigger.dev@0.0.0-re2-20250523160855 deploy --env preview -a https://matt-webapp.trigger.dev --self-hosted env: TRIGGER_ACCESS_TOKEN: ${{ secrets.TRIGGER_ACCESS_TOKEN }}