-
Notifications
You must be signed in to change notification settings - Fork 3
61 lines (54 loc) · 1.77 KB
/
deploy.yml
File metadata and controls
61 lines (54 loc) · 1.77 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
name: Build and Deploy
on:
workflow_dispatch: {}
env:
OUT_DIR: .next
AWS_REGION: eu-central-1
DEPLOYMENT_BUCKET: exploration-webappdeploymentbucket-127zs8usx561t
NEXT_DATOCMS_API_TOKEN: ${{ secrets.NEXT_DATOCMS_API_TOKEN }}
SCHEMA_URL: ${{ secrets.SCHEMA_URL }}
jobs:
build:
name: Build
runs-on: ubuntu-20.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v2
name: Checkout Repository
- uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.IAMROLE_GITHUB }}
role-session-name: GitHub-Action-Role
aws-region: ${{ env.AWS_REGION }}
- uses: actions/setup-node@v3
with:
node-version: '16.13'
cache: 'npm'
- run: npm ci
- run: npm run build
- name: Upload Artifact to s3
run: aws s3 sync ${{ env.OUT_DIR }} s3://${{ env.DEPLOYMENT_BUCKET }}/
deploy:
needs: build
runs-on: ubuntu-latest
environment: Dev
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@v2
- uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: ${{ secrets.IAMROLE_GITHUB }}
role-session-name: GitHub-Action-Role
aws-region: ${{ env.AWS_REGION }}
- run: |
echo "Deploying branch ${{ env.GITHUB_REF }} to ${{ github.event.inputs.environment }}"
COMMIT_HASH=`git rev-parse HEAD`
aws deploy create-deployment \
--application-name CodeDeployAppNameWithASG \
--deployment-group-name ExplorationDeploymentGroup \
--github-location repository=$GITHUB_REPOSITORY,commitId=$COMMIT_HASH \
--ignore-application-stop-failures