-
Notifications
You must be signed in to change notification settings - Fork 53
125 lines (107 loc) · 3.2 KB
/
release.yml
File metadata and controls
125 lines (107 loc) · 3.2 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
name: Release
on:
workflow_run:
workflows: ['CI/CD Pipeline']
types: [completed]
workflow_dispatch:
inputs:
deploy:
description: 'Deployment target (canary|prod)'
required: true
default: 'canary'
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release:
name: semantic-release
if: |
(github.event_name == 'workflow_run' &&
github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.head_branch == 'main') ||
github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
cache: npm
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
expo-canary:
name: Expo Canary Deploy
needs: release
if: ${{ github.event.inputs.deploy == 'canary' || github.event_name == 'workflow_run' }}
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 --legacy-peer-deps
- name: Publish to Expo Canary channel
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
run: |
npx expo login --token $EXPO_TOKEN
npx expo publish --release-channel canary
expo-promote:
name: Promote Canary to Production
needs: expo-canary
if: ${{ github.event.inputs.deploy == 'prod' }}
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 --legacy-peer-deps
- name: Promote to Production channel
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
run: |
npx expo login --token $EXPO_TOKEN
npx expo publish --release-channel production --release-channel canary
expo-rollback:
name: Expo Rollback
if: ${{ github.event.inputs.deploy == 'rollback' }}
runs-on: ubuntu-latest
steps:
- name: Checkout previous tag
run: |
git fetch --tags
PREV_TAG=$(git describe --tags --abbrev=0 HEAD~1)
git checkout $PREV_TAG
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci --legacy-peer-deps
- name: Publish previous build to Production
env:
EXPO_TOKEN: ${{ secrets.EXPO_TOKEN }}
run: |
npx expo login --token $EXPO_TOKEN
npx expo publish --release-channel production