-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (103 loc) · 3.57 KB
/
netlify-deploy-v1.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
---
name: Deploy an application to netlify
on:
workflow_call:
inputs:
application:
type: string
required: true
environment:
type: string
required: true
version:
type: string
required: true
s3_bucket:
type: string
required: true
aws_region:
type: string
default: "eu-central-1"
ci_iam_role:
type: string
default: ""
netlify_deploy_timeout:
type: number
default: 2
runs_on:
type: string
default: ubuntu-latest-arm64
jobs:
deploy:
runs-on: ${{ inputs.runs_on }}
environment: ${{ inputs.environment }}
permissions:
actions: write
id-token: write
contents: write
pull-requests: write
statuses: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Validate production version format
if: ${{ inputs.environment == 'production' }}
run: |
echo "Validating that production version has a valid format (must be v{major}.{minor}.{patch})"
echo "${{ inputs.version }}" | grep -P '^v[0-9]+\.[0-9]+\.[0-9]+$'
- name: Configure aws credentials
uses: sencrop/github-workflows/actions/configure-aws-credentials@master
with:
aws_account_id: ${{ vars.AWS_ACCOUNT_ID }}
aws_region: ${{ inputs.aws_region }}
ci_iam_role: ${{ inputs.ci_iam_role }}
- name: Download build artifact
uses: sencrop/github-workflows/actions/download-artifact@master
with:
application: ${{ inputs.application }}
s3_bucket: ${{ inputs.s3_bucket }}
version: ${{ inputs.version }}
local_dir: ./build
- name: Lookup deployed version
uses: sencrop/github-workflows/actions/lookup-deployed-version@master
id: deployed_version
with:
environment: ${{ inputs.environment }}
- name: Notify deployment in progress
uses: sencrop/github-workflows/actions/notify-deployment-in-progress-v2@master
with:
application: ${{ inputs.application }}
environment: ${{ inputs.environment }}
dd_api_key: ${{ secrets.DD_API_KEY }}
former_version: ${{ steps.deployed_version.outputs.version }}
new_version: ${{ inputs.version }}
slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Add environment tag
uses: sencrop/github-workflows/actions/add-git-tag@master
with:
tag: ${{ inputs.environment }}
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v3
with:
publish-dir: ./build
production-deploy: true
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
netlify-config-path: "./netlify.toml"
enable-pull-request-comment: false
enable-commit-comment: true
overwrites-pull-request-comment: false
enable-github-deployment: true
github-deployment-environment: ${{ inputs.environment }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ vars.NETLIFY_SITE_ID }}
timeout-minutes: ${{ inputs.netlify_deploy_timeout }}
- name: Track deployment time
uses: sencrop/github-workflows/actions/track-deployment-time-v2@master
with:
application: ${{ inputs.application }}
environment: ${{ inputs.environment }}
dd_api_key: ${{ secrets.DD_API_KEY }}