-
Notifications
You must be signed in to change notification settings - Fork 59
96 lines (82 loc) · 3.22 KB
/
main.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
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
name: phoenix-ci
on: [pull_request, workflow_dispatch]
jobs:
build-and-test:
permissions: write-all
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout
uses: actions/checkout@main
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@main
with:
node-version: ${{ matrix.node-version }}
- name: Setup
run: yarn install
- name: Lint
run: yarn lint
- name: Test
run: yarn test:ci
- name: Documentation Coverage
run: yarn docs:coverage
- name: Code Coverage
uses: coverallsapp/github-action@master
with:
base-path: ./packages/phoenix-event-display
path-to-lcov: ./packages/phoenix-event-display/coverage/lcov.info
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Pre Deploy Pull Request
uses: jwalton/gh-find-current-pr@master
id: if_pr
- name: Deploy
id: deploy
if: ${{ steps.if_pr.outputs.number || github.ref == 'refs/heads/main' }}
env:
PR_URL: http://phoenix-pr-${{ steps.if_pr.outputs.number }}.surge.sh
DEV_URL: http://phoenix-dev.surge.sh
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
run: |
yarn deploy:web
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
export DEPLOYMENT_URL=$DEV_URL
export DEPLOYMENT_ENV=dev
else
export DEPLOYMENT_URL=$PR_URL
export DEPLOYMENT_ENV=pull-request
fi
npx surge --project ./packages/phoenix-ng/docs/ --domain $DEPLOYMENT_URL
echo "::set-output name=deployment_url::$DEPLOYMENT_URL"
echo "::set-output name=deployment_env::$DEPLOYMENT_ENV"
- name: Create Deployment
id: create_deployment
if: ${{ success() && (steps.if_pr.outputs.number || github.ref == 'refs/heads/main') }}
uses: octokit/request-action@v2.x
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
route: POST /repos/{repository}/deployments
repository: ${{ github.repository }}
ref: ${{ github.ref }}
environment: ${{ steps.deploy.outputs.deployment_env }}
required_contexts: '[]'
auto_merge: false
- name: Create Deployment Status
if: ${{ success() && (steps.if_pr.outputs.number || github.ref == 'refs/heads/main') }}
uses: octokit/request-action@v2.x
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
route: POST /repos/{repository}/deployments/{deployment_id}/statuses
repository: ${{ github.repository }}
deployment_id: ${{ fromJSON(steps.create_deployment.outputs.data).id }}
state: success
target_url: ${{ steps.deploy.outputs.deployment_url }}
description: Deployed to environment ${{ steps.deploy.outputs.deployment_env }}
environment: ${{ steps.deploy.outputs.deployment_env }}
environment_url: ${{ steps.deploy.outputs.deployment_url }}
mediaType: '{ "previews": ["flash", "ant-man"] }'