-
Notifications
You must be signed in to change notification settings - Fork 7
76 lines (73 loc) · 2.72 KB
/
sync-package.yml
File metadata and controls
76 lines (73 loc) · 2.72 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
name: Sync package
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
on:
workflow_call:
inputs:
module_name:
required: true
type: string
package_name:
required: true
type: string
secrets:
S3_BUCKET_NAME:
required: true
SYNC_LAMBDA_ARN:
required: true
GITFARM_LAN_SDK_REPO:
required: true
GITFARM_LAN_SDK_BRANCH:
required: true
ACTIONS_SYNC_ROLE_NAME:
required: true
jobs:
upload-to-S3-and-sync-to-Gitfarm:
runs-on: ubuntu-latest
steps:
- name: Git clone the repository
uses: actions/checkout@v6
- name: Set up JDK 17
uses: actions/setup-java@v5
with:
java-version: '17'
distribution: 'corretto'
cache: maven
- name: Get version
id: get_version
run: |
VERSION=$( mvn -f ${{ inputs.module_name }}/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout )
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
- name: Show extracted Maven project version
run: echo ${{ steps.get_version.outputs.version }}
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7
with:
role-to-assume: "${{ secrets.ACTIONS_SYNC_ROLE_NAME }}"
role-session-name: samplerolesession
aws-region: ${{ env.AWS_REGION }}
# Upload a file to AWS s3
- name: Copy tgz build file to s3
run: |
aws s3 cp ./${{ inputs.module_name }}/target/${{ inputs.package_name }}-${{ steps.get_version.outputs.version }}.jar \
s3://${{ secrets.S3_BUCKET_NAME }}/${{ inputs.package_name }}.jar
- name: commit 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":"${{ secrets.GITFARM_LAN_SDK_REPO }}-1.0.jar","s3Bucket":"${{ secrets.S3_BUCKET_NAME }}","s3FilePath":"${{ inputs.package_name }}.jar", "gitHubRepo": "aws-durable-execution-sdk-java", "gitHubCommit":"${{ github.sha }}"}' \
--cli-binary-format raw-in-base64-out \
output.txt
- name: Check for specific text in a file
id: check_text
run: |
if grep -q "Error" output.txt; then
cat output.txt
exit 1
fi