https://github.com/expo/expo-github-action#creating-a-new-eas-build
利用github actions来对项目进行持续化集成,我现在开发的项目是expo项目,expo发布本来就十分简单,但是随着项目的壮大,持续化集成已经成为不得不考虑的辅助措施了。
关于github actions的介绍:
actions workfows
简单而言就是可以再.github/workflows/下面添加yml文件,通过一定的语法来触发action,比如每次在push之后自动触发就可以添加on: [push],pr合并之后触发等等,支持的触发事件,还可以支持具体哪些branch才会触发之类,功能很强大,甚至比jenkins还方便。这里记录一下本人集成expo项目的过程,以备后续深挖:
在该目录下添加deploy-dev.yml文件(文件名字随意,有意义即可,可以添加多个),其内容如下:
# PR to dev/main, run tests and create review
name: CI Pull Request
on: [push]
# on:
# pull_request:
# # branches-ignore:
# # - 'main'
# paths:
# - 'src/**'
jobs:
ci-test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
node: [14]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- name: Gen Token
run: |
echo "//npm.pkg.github.com/:_authToken=${{ secrets.REPO_READ_TOKEN }}" > ~/.npmrc
- name: Install
run: yarn install --frozen-lockfile
- name: Lint
run: yarn lint
# - name: Build
# run: yarn build
# - name: Test
# run: yarn test
review:
needs: [ci-test]
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
node: [14]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: expo/expo-github-action@v6
with:
expo-version: 4.x
token: ${{ secrets.EXPO_TOKEN }}
# expo-username: "niejianlong@cavalry.online"
# expo-password: "NJLd123456"
- name: Echo Token
run: echo "${{ secrets.EXPO_TOKEN }}"
# - name: Gen Token
# run: |
# echo "//npm.pkg.github.com/:_authToken=${{ secrets.REPO_READ_TOKEN }}" > ~/.npmrc
- name: Install
run: yarn install --frozen-lockfile
- name: Gen Graphql
run: yarn gen:gql
- name: Expo Publish Review
run: expo publish --release-channel staging-v1
- name: Find Comment
uses: peter-evans/find-comment@v1
id: fc
with:
# issue-number: ${{ github.event.pull_request.number }}
issue-number: 1
comment-author: "github-actions[bot]"
body-includes: This is a QR code for access to the preview app.
- name: Comment Review QR code
if: steps.fc.outputs.comment-id == ''
uses: peter-evans/create-or-update-comment@v1
with:
# issue-number: ${{ github.event.pull_request.number }}
issue-number: 2
body: |
:lock: This is a QR code for access to the preview app.
:iphone: Scan a code with your device.












网友评论