-
Notifications
You must be signed in to change notification settings - Fork 13
44 lines (39 loc) · 1.41 KB
/
mobile-cicd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: "Mobile CI / CD"
on:
pull_request:
types: [opened, synchronize, closed]
push:
branches:
- 'main'
- 'dev'
jobs:
mobile:
name: "Mobile"
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.action != 'closed'
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Sets env vars for pull request
if: github.event_name == 'pull_request'
run: |
echo "PROFILE=development" >> $GITHUB_ENV
echo "TARGET=base" >> $GITHUB_ENV
- name: Sets env vars for dev push
if: github.event_name != 'pull_request' && github.ref != 'refs/heads/main'
run: |
echo "PROFILE=development" >> $GITHUB_ENV
echo "TARGET=build" >> $GITHUB_ENV
- name: Sets env vars for main push
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
run: |
echo "PROFILE=production" >> $GITHUB_ENV
echo "TARGET=build" >> $GITHUB_ENV
# Build
- name: Build mobile image
run: |
docker build --build-arg PROFILE=${{ env.PROFILE }} --build-arg BUILD_NUMBER=${{ github.run_number }} --build-arg EXPO_TOKEN=${{ secrets.EXPO_TOKEN }} --target ${{ env.TARGET }} .