Skip to content

Commit 5a3e2df

Browse files
committed
feat: ci
1 parent 8795631 commit 5a3e2df

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
name: '📦 Create internal build'
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
platform:
6+
description: 'Platform to submit (ios or android)'
7+
required: true
8+
type: choice
9+
options:
10+
- ios
11+
- android
12+
profile:
13+
description: 'Environment'
14+
required: true
15+
type: choice
16+
options:
17+
- staging
18+
- production
19+
app_version:
20+
description: 'App version to submit'
21+
required: true
22+
type: string
23+
24+
jobs:
25+
build:
26+
name: Install and build
27+
runs-on: ubuntu-latest
28+
steps:
29+
- name: 💯 Check for EXPO_TOKEN
30+
run: |
31+
if [ -z "${{ secrets.EXPO_TOKEN }}" ]; then
32+
echo "You must provide an EXPO_TOKEN secret linked to this project's Expo account in this repo's secrets. Learn more: https://docs.expo.dev/eas-update/github-actions"
33+
exit 1
34+
fi
35+
36+
- name: 💯 Check for ENV_FILE_DEVELOPMENT
37+
run: |
38+
if [ -z "${{ secrets.ENV_FILE_DEVELOPMENT }}" ]; then
39+
echo "You must provide an ENV_FILE_DEVELOPMENT secret linked to this project"
40+
exit 1
41+
fi
42+
43+
- name: 💯 Check for ENV_FILE_PRODUCTION
44+
run: |
45+
if [ -z "${{ secrets.ENV_FILE_PRODUCTION }}" ]; then
46+
echo "You must provide an ENV_FILE_PRODUCTION secret linked to this project"
47+
exit 1
48+
fi
49+
50+
- name: Checkout Repo
51+
uses: actions/checkout@v3
52+
53+
- name: ⚡️ Setup Bun
54+
uses: oven-sh/setup-bun@v1
55+
with:
56+
bun-version: latest
57+
58+
- name: 🙆🏼‍♂️ Update package.json version
59+
run: |
60+
NEW_VERSION=${{ github.event.inputs.app_version }}
61+
echo "Updating package.json to version $NEW_VERSION"
62+
bun run npm version $NEW_VERSION --no-git-tag-version
63+
- name: 🙆🏼‍♂️ Verify updated version
64+
run: cat package.json
65+
66+
- name: ⚡️ Setup EAS
67+
uses: expo/expo-github-action@v8
68+
with:
69+
eas-version: latest
70+
token: ${{ secrets.EXPO_TOKEN }}
71+
72+
- name: Create env file
73+
run: |
74+
echo "${{ secrets.ENV_FILE_DEVELOPMENT }}" > .env.staging
75+
echo "${{ secrets.ENV_FILE_PRODUCTION }}" > .env.production
76+
77+
- name: Install dependencies
78+
run: bun install
79+
80+
- name: Upload Secrets
81+
run: ./deploy_secrets.sh ${{ github.event.inputs.profile }}
82+
83+
- name: 📱 Run Build
84+
run: APP_VERSION=${{github.event.inputs.app_version}} eas build --platform ${{github.event.inputs.platform}} --profile ${{github.event.inputs.profile}}-preview --non-interactive --json > build_output.json
85+
86+
- name: 🛠️ Install jq
87+
run: sudo apt-get install -y jq
88+
89+
- name: 🖨️ Print build_output.json
90+
run: cat build_output.json
91+
92+
- name: 🔍 Extract BuildID
93+
run: |
94+
BUILD_ID=$(jq -r '.[0].id' build_output.json)
95+
echo "Build ID is $BUILD_ID"
96+
echo "BUILD_ID=$BUILD_ID" >> $GITHUB_ENV
97+
98+
## Run slack or other notification here

.github/workflows/lint.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Lint on PR
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
13+
- name: Set up Bun
14+
uses: oven-sh/setup-bun@v1
15+
with:
16+
bun-version: latest
17+
18+
- name: Install dependencies
19+
run: bun install
20+
21+
- name: Run ESLint
22+
run: |
23+
bun run lint --quiet || true
24+
if bun run lint --quiet --format json | jq '.[].errorCount' | grep -q '[1-9]'; then
25+
exit 1
26+
fi

0 commit comments

Comments
 (0)