This repository has been archived by the owner on Aug 30, 2023. It is now read-only.
/
action.yml
80 lines (77 loc) · 2.86 KB
/
action.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
name: "Build AWS Lambda Layer"
description: "Creates a Lambda layer including the Sentry SDK and the Sentry Lambda extension."
inputs:
artifact_name:
description: "Name of the prepared articact the Lambda Layer zip file should be uploaded to"
required: true
zip_file_name:
description: "Name of the zip file that will be created"
required: true
build_cache_key:
description: "Build cache key"
required: true
build_cache_paths:
description: "Paths of the build cache"
required: true
debug_enabled:
description: 'Run the build with tmate debugging enabled? (https://github.com/marketplace/actions/debugging-with-tmate)'
required: false
default: "false"
runs:
using: "composite"
steps:
- name: "Check build cache"
uses: actions/cache@v2
id: cache_built_packages
with:
path: ${{ inputs.build_cache_paths }}
key: ${{ inputs.build_cache_key }}
- name: Download latest relay
shell: bash
run: |
echo "Downloading relay..."
mkdir -p dist-serverless/relay
curl -0 --silent \
--output dist-serverless/relay/relay \
"$(curl -s https://release-registry.services.sentry.io/apps/relay/latest | jq -r .files.\"relay-Linux-x86_64\".url)"
chmod +x dist-serverless/relay/relay
echo "Done downloading relay."
- name: Configure Lambda extension to start relay
shell: bash
run: |
echo "Creating start script..."
mkdir -p dist-serverless/extensions
cat > dist-serverless/extensions/sentry-lambda-extension << EOT
#!/bin/bash
set -euo pipefail
exec /opt/relay/relay run \
--mode=proxy \
--port=5333 \
--shutdown-timeout=2 \
--upstream-dsn="\$SENTRY_DSN" \
--aws-runtime-api="\$AWS_LAMBDA_RUNTIME_API"
EOT
chmod +x dist-serverless/extensions/sentry-lambda-extension
echo "Done creating start script."
- name: "Setup tmate session"
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.debug_enabled == 'true' }}
- name: "Create Lambda Layer zip"
shell: bash
run: |
echo "Creating ${{ inputs.zip_file_name }}..."
cd dist-serverless
# preserving symlinks with -y is important for Node based Layers!
zip -r -y ../${{ inputs.zip_file_name }} . --exclude \*__pycache__\* --exclude \*.yml
cd ..
echo "Done creating ${{ inputs.zip_file_name }}."
echo "Contents of the created zip file:"
unzip -Z ${{ inputs.zip_file_name }}
- name: "Setup tmate session"
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.debug_enabled == 'true' }}
- name: "Upload zip (will be picked up by Craft for deployment)"
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.artifact_name }}
path: ${{ inputs.zip_file_name }}