-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (62 loc) · 2.43 KB
/
release.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
---
name: release
run-name: Release ${{ github.event.client_payload.ref }}${{ github.event.inputs.ref }} to ${{ github.event.inputs.environment }}${{ github.event.client_payload.environment }}
on:
workflow_dispatch:
inputs:
environment:
description: Environment to release
required: true
default: production
ref:
description: Ref to release
required: true
default: master
repository_dispatch:
types:
- release
jobs:
deploy:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.event.client_payload.ref }}${{ github.event.inputs.ref }}
- name: Start deployment
uses: bobheadxi/deployments@v1
id: deployment
with:
step: start
env: ${{ github.event.inputs.environment }}${{ github.event.client_payload.environment }}
desc: ${{ github.event.client_payload.ref }}${{ github.event.client_payload.ref }}
ref: ${{ github.event.client_payload.ref }}${{ github.event.inputs.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- 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 }}
- name: Setup
uses: ./.github/actions/setup
- name: Serverless deploy to production from ${{ github.event.client_payload.ref }}${{ github.event.inputs.ref }}
run: npm run deploy
if: ${{ github.event.inputs.environment == 'production' || github.event.client_payload.environment == 'production' }}
env:
SERVERLESS_STAGE: prod
- name: Serverless deploy to staging from ${{ github.event.client_payload.ref }}${{ github.event.inputs.ref }}
run: npm run deploy
if: ${{ github.event.inputs.environment == 'staging' || github.event.client_payload.environment == 'staging' }}
env:
SERVERLESS_STAGE: stg
- name: Finish deployment
uses: bobheadxi/deployments@v1
if: always()
with:
step: finish
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env: ${{ steps.deployment.outputs.env }}
token: ${{ secrets.GITHUB_TOKEN }}