-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy pathmanual-reward-root-submitter.yml
More file actions
70 lines (60 loc) · 2.41 KB
/
manual-reward-root-submitter.yml
File metadata and controls
70 lines (60 loc) · 2.41 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
name: Manual Deploy [reward root submitter]
on:
workflow_dispatch:
inputs:
environment:
description: Deployment environment
required: false
default: staging
permissions:
contents: read
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up env
env:
INPUT_ENVIRONMENT: ${{ github.event.inputs.environment }}
run: |
if [ "$INPUT_ENVIRONMENT" = "production" ]; then
echo "AWS_ROLE_ARN=arn:aws:iam::120317779495:role/waypoint" >> $GITHUB_ENV
echo "WAYPOINT_SERVER_TOKEN=${{ secrets.PRODUCTION_WAYPOINT_SERVER_TOKEN }}" >> $GITHUB_ENV
echo "WAYPOINT_SERVER_ADDR=${{ secrets.PRODUCTION_WAYPOINT_SERVER_ADDR }}" >> $GITHUB_ENV
cp waypoint.prod.hcl waypoint.hcl
elif [ "$INPUT_ENVIRONMENT" = "staging" ]; then
echo "AWS_ROLE_ARN=arn:aws:iam::680542703984:role/waypoint" >> $GITHUB_ENV
echo "WAYPOINT_SERVER_TOKEN=${{ secrets.STAGING_WAYPOINT_SERVER_TOKEN }}" >> $GITHUB_ENV
echo "WAYPOINT_SERVER_ADDR=${{ secrets.STAGING_WAYPOINT_SERVER_ADDR }}" >> $GITHUB_ENV
else
echo "unrecognized environment"
exit 1;
fi
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2.0.0
with:
role-to-assume: ${{ env.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Install dependencies
shell: bash
run: sudo apt-get install jq
- uses: lucasmelin/setup-waypoint@v1
with:
version: "0.11.3"
- name: Build reward submitter
run: waypoint build -app=reward-submit-lambda
env:
WAYPOINT_SERVER_TLS: "1"
- name: Update reward submitter
run: |
aws lambda update-function-code --function-name reward_root_submitter --image-uri $(aws lambda get-function --function-name reward_root_submitter | jq -r '.Code.ImageUri')
time aws lambda wait function-updated --function-name reward_root_submitter
- name: Send notification to Discord
if: ${{ always() }}
uses: ./.github/actions/discord-notification-deploy
with:
app: reward-submit-lambda
status: ${{ github.action_status }}
environment: ${{ github.event.inputs.environment }}
webhook: ${{ secrets.DISCORD_WEBHOOK }}