forked from adrianhajdin/project_syncfusion_dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreact-github.yml
82 lines (81 loc) · 2.66 KB
/
react-github.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
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
- name: Install dependencies
run: npm install
- name: Test
run: npm test
env:
CI: true
- name: Generate build
run: npm run build
# Share artifact inside workflow
- name: Share artifact inside workflow
uses: actions/upload-artifact@v1
with:
name: react-github-actions-build
path: build
deploy:
runs-on: ubuntu-latest
# When application is successfully tested and build has been created
# Then we can start with deployment
needs: build
steps:
# Download previously shared build
- name: Get artifact
uses: actions/download-artifact@v1
with:
name: react-github-actions-build
# Set the credentials from repository settings/secrets
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_DEFAULT_REGION }}
# Copy the files from build folder to the S3 bucket
- name: Deploy to S3
run: aws s3 sync . s3://react-github-actions --acl public-read
working-directory: react-github-actions-build
release:
runs-on: ubuntu-latest
# We specify that deploys needs to
# finish before we create a release
needs: deploy
steps:
# Download previously shared build
- name: Get artifact
uses: actions/download-artifact@v1
with:
name: react-github-actions-build
# Zip the build using external action
- name: Zip build
uses: thedoctor0/zip-release@master
with:
filename: react-github-actions-release-build.zip
path: react-github-actions-build
# Upload as an artifact of the current workflow
- name: Upload build zip artifact
uses: actions/upload-artifact@v1
with:
name: react-github-actions-release-build.zip
path: react-github-actions-release-build.zip
# Make official GitHub release which will trigger
# sending the mail with link for access
- name: Release
uses: ncipollo/release-action@v1
with:
artifacts: react-github-actions-release-build.zip
body: https://react-github-actions.s3.amazonaws.com/index.html
token: ${{ secrets.GITHUB_TOKEN }}