Skip to content

Commit c7d998f

Browse files
committed
chore: wip
1 parent 96ec3c2 commit c7d998f

File tree

4 files changed

+79
-147
lines changed

4 files changed

+79
-147
lines changed

.github/workflows/ci.yml

Lines changed: 79 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ name: CI
33
on:
44
push:
55
branches:
6-
- main
6+
- main # deploys to prod
7+
# tags: # I don't think this is necessary because these version tags get pushed into main
8+
# - '*-beta.*' # deploys to stage
79

810
pull_request:
911
branches:
10-
- main
12+
- main # deploys to dev
1113

1214
env:
1315
PR_NUMBER: '${{ github.event.number }}'
@@ -111,61 +113,78 @@ jobs:
111113
- name: Test Suite
112114
run: bun --bun run test
113115

114-
# you may need to "Allow GitHub Actions to create and approve pull requests"
115-
# https://stackoverflow.com/questions/72376229/github-actions-is-not-permitted-to-create-or-approve-pull-requests-createpullre
116-
# js-cs-fixer:
117-
# if: github.event_name == 'pull_request' && ! startsWith(github.ref, 'refs/heads/auto-fixed/')
118-
# runs-on: ${{ matrix.os }}
119-
120-
# strategy:
121-
# matrix:
122-
# os: [ubuntu-latest]
123-
124-
# steps:
125-
# - name: Checkout Code
126-
# uses: actions/checkout@v4
127-
128-
# - name: Setup Bun
129-
# uses: oven-sh/setup-bun@v1
130-
131-
# - name: Use cached node_modules
132-
# uses: actions/cache@v4
133-
# with:
134-
# path: node_modules
135-
# key: node-modules-${{ hashFiles('**/bun.lockb') }}
136-
# restore-keys: |
137-
# node-modules-
138-
139-
# - name: Install Dependencies
140-
# run: bun install
141-
142-
# - name: Set Application Key
143-
# run: bun buddy key:generate
144-
145-
# - name: Prepare Git User
146-
# run: |
147-
# git config --global user.name "github-actions[bot]"
148-
# git config --global user.email "action@github.com"
149-
# git checkout -B "${{ env.FIXER_BRANCH }}"
150-
151-
# - name: Apply auto-fixers
152-
# run: bun lint:fix
153-
154-
# - name: Create Fixer PR
155-
# run: |
156-
# if [[ -z $(git status --porcelain) ]]; then
157-
# echo "Nothing to fix... Exiting."
158-
# exit 0
159-
# fi
160-
# OPEN_PRS=`curl --silent -H "Accept: application/vnd.github.v3+json" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls?state=open"`
161-
# OPEN_FIXER_PRS=`echo ${OPEN_PRS} | grep -o "\"ref\": \"${{ env.FIXER_BRANCH }}\"" | wc -l`
162-
# git commit -am "${{ env.TITLE }}"
163-
# git push origin "${{ env.FIXER_BRANCH }}" --force
164-
# if [ ${OPEN_FIXER_PRS} -eq "0" ]; then
165-
# curl -X POST \
166-
# -H "Accept: application/vnd.github.v3+json" \
167-
# -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
168-
# "https://api.github.com/repos/$GITHUB_REPOSITORY/pulls" \
169-
# -d "{ \"head\":\"${{ env.FIXER_BRANCH }}\", \"base\":\"${{ env.SOURCE_BRANCH }}\", \"title\":\"${{ env.TITLE }}\", \"body\":\"${{ env.DESCRIPTION }}\n\nTriggered by #${{ env.PR_NUMBER }}\" }"
170-
# fi
171-
# exit 1
116+
deploy-prod:
117+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
118+
119+
runs-on: ubuntu-latest
120+
121+
environment: production
122+
123+
steps:
124+
- name: Checkout Code
125+
uses: actions/checkout@v4
126+
127+
- name: Setup Bun
128+
uses: oven-sh/setup-bun@v1
129+
130+
- name: Use cached node_modules
131+
uses: actions/cache@v4
132+
with:
133+
path: node_modules
134+
key: node-modules-${{ hashFiles('**/bun.lockb') }}
135+
restore-keys: |
136+
node-modules-
137+
138+
- name: Install Dependencies
139+
run: bun install
140+
141+
deploy-stage:
142+
if: startsWith(github.ref, 'refs/tags/') && contains(github.ref, '-beta.')
143+
144+
runs-on: ubuntu-latest
145+
146+
environment: staging
147+
148+
steps:
149+
- name: Checkout Code
150+
uses: actions/checkout@v4
151+
152+
- name: Setup Bun
153+
uses: oven-sh/setup-bun@v1
154+
155+
- name: Use cached node_modules
156+
uses: actions/cache@v4
157+
with:
158+
path: node_modules
159+
key: node-modules-${{ hashFiles('**/bun.lockb') }}
160+
restore-keys: |
161+
node-modules-
162+
163+
- name: Install Dependencies
164+
run: bun install
165+
166+
deploy-dev:
167+
if: github.event_name == 'pull_request' && github.base_ref == 'main'
168+
169+
runs-on: ubuntu-latest
170+
171+
environment: development
172+
173+
steps:
174+
- name: Checkout Code
175+
uses: actions/checkout@v4
176+
177+
- name: Setup Bun
178+
uses: oven-sh/setup-bun@v1
179+
180+
- name: Use cached node_modules
181+
uses: actions/cache@v4
182+
with:
183+
path: node_modules
184+
key: node-modules-${{ hashFiles('**/bun.lockb') }}
185+
restore-keys: |
186+
node-modules-
187+
188+
- name: Install Dependencies
189+
run: bun install
190+

.github/workflows/deploy-dev.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/deploy-prod.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

.github/workflows/deploy-stage.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)