-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-deploy-lambda-function-workflow.yml
More file actions
78 lines (68 loc) · 2.39 KB
/
test-deploy-lambda-function-workflow.yml
File metadata and controls
78 lines (68 loc) · 2.39 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
name: 'Run deploy-lambda-function workflow'
on:
pull_request:
paths:
# dependencies
- actions/deploy-to-s3-bucket/*
- actions/notify-slack/*
- .github/workflows/notify-slack.yml
# The code being tested
- actions/deploy-lambda-function/*
- .github/workflows/deploy-lambda-function.yml
- .github/workflows/test-deploy-lambda-function-workflow.yml
permissions:
contents: read # default
id-token: write # aws auth
defaults:
run:
shell: bash
jobs:
create-lambda-function-asset:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v6
- name: 'Create archive file'
shell: bash
working-directory: .github/actions/test-deploy-lambda-function-workflow
run: |
sed -i "s/const VERSION = 'dev'/const VERSION = '${{ github.sha }}'/" index.js
zip archive.zip ./index.js
- name: 'Upload the archive file'
uses: actions/upload-artifact@v4
with:
name: lambda-function
path: .github/actions/test-deploy-lambda-function-workflow/archive.zip
run-deploy-lambda-function-workflow:
uses: ./.github/workflows/deploy-lambda-function.yml
needs: create-lambda-function-asset
with:
environment: staging
# lambda options
pattern: archive.zip
artifact-name: lambda-function
function-name: shopsmart-github-actions-tests
function-tags: test=shopsmart/github-actions/deploy-lambda-function-workflow
s3-bucket: shopsmart-github-actions-tests
s3-key: ${{ github.sha }}/archive.zip
current-version-path: .current-versions/staging
# aws options
role-name: github-actions-tests
# slack options
notify-slack: true
application: github-actions
secrets:
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
validate-deploy-lambda-function-workflow:
name: 'Run validation against the deploy-lambda-function workflow run'
needs: run-deploy-lambda-function-workflow
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v6
- uses: ./.github/actions/test-deploy-lambda-function-workflow
with:
published-version: ${{ needs.run-deploy-lambda-function-workflow.outputs.published-version }}
aws-account-id: ${{ secrets.AWS_ACCOUNT_ID }}