generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 13
72 lines (68 loc) · 2.99 KB
/
sync-package.yml
File metadata and controls
72 lines (68 loc) · 2.99 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
name: Sync package
on:
push:
branches: [ "main" ]
env:
AWS_REGION : "us-west-2"
# permission can be added at job level or workflow level
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
on-success:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.13"]
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install Hatch
run: |
python -m pip install --upgrade hatch==1.16.5
- name: Build distribution
run: hatch build
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
with:
role-to-assume: "${{ secrets.ACTIONS_SYNC_ROLE_NAME }}"
role-session-name: gh-python
aws-region: ${{ env.AWS_REGION }}
- name: Copy tar gz build file to s3
run: |
aws s3 cp ./dist/*.tar.gz \
s3://${{ secrets.S3_BUCKET_NAME }}/aws-durable-execution-sdk-python.tar.gz
- name: commit tar gz to Gitfarm
run: |
aws lambda invoke \
--function-name ${{ secrets.SYNC_LAMBDA_ARN }} \
--payload '{"gitFarmRepo":"${{ secrets.GITFARM_LAN_SDK_REPO }}","gitFarmBranch":"${{ secrets.GITFARM_LAN_SDK_BRANCH }}","gitFarmFilepath":"aws-durable-execution-sdk-python.tar.gz","s3Bucket":"${{ secrets.S3_BUCKET_NAME }}","s3FilePath":"aws-durable-execution-sdk-python.tar.gz", "gitHubRepo": "aws-durable-execution-sdk-python", "gitHubCommit":"${{ github.sha }}"}' \
--cli-binary-format raw-in-base64-out \
output.txt
- name: Check for error in lambda invoke
run: |
if grep -q "Error" output.txt; then
cat output.txt
exit 1
fi
- name: Copy whl build file to s3
run: |
aws s3 cp ./dist/*.whl \
s3://${{ secrets.S3_BUCKET_NAME }}/aws-durable-execution-sdk-python.whl
- name: commit whl to Gitfarm
run: |
aws lambda invoke \
--function-name ${{ secrets.SYNC_LAMBDA_ARN }} \
--payload '{"gitFarmRepo":"${{ secrets.GITFARM_LAN_SDK_REPO }}","gitFarmBranch":"${{ secrets.GITFARM_LAN_SDK_BRANCH }}","gitFarmFilepath":"aws-durable-execution-sdk-python.whl","s3Bucket":"${{ secrets.S3_BUCKET_NAME }}","s3FilePath":"aws-durable-execution-sdk-python.whl", "gitHubRepo": "aws-durable-execution-sdk-python", "gitHubCommit":"${{ github.sha }}"}' \
--cli-binary-format raw-in-base64-out \
output.txt
- name: Check for error in lambda invoke
run: |
if grep -q "Error" output.txt; then
cat output.txt
exit 1
fi