|
1 | 1 | name: syncS3andKB |
2 | 2 | on: |
3 | 3 | push: |
4 | | - branches: ["main"] |
| 4 | + branches: ["sync-for-steer-specs"] |
5 | 5 | workflow_dispatch: |
6 | 6 | inputs: |
7 | 7 | sdk_name: |
|
21 | 21 | - php |
22 | 22 | - cpp |
23 | 23 | - kotlin |
| 24 | + - steering_docs |
| 25 | + - specs |
| 26 | + - coding-standards |
24 | 27 |
|
25 | 28 | permissions: |
26 | 29 | id-token: write |
@@ -53,11 +56,35 @@ jobs: |
53 | 56 | echo "S3_LANGUAGE=rust" >> $GITHUB_ENV |
54 | 57 | elif [ "$sdk_name" == "gov2" ]; then |
55 | 58 | echo "S3_LANGUAGE=go" >> $GITHUB_ENV |
| 59 | + elif [ "$sdk_name" == "steering_docs" ]; then |
| 60 | + echo "S3_LANGUAGE=steering-docs" >> $GITHUB_ENV |
| 61 | + elif [ "$sdk_name" == "coding-standards" ]; then |
| 62 | + echo "S3_LANGUAGE=coding-standards" >> $GITHUB_ENV |
| 63 | + elif [ "$sdk_name" == "specs" ]; then |
| 64 | + echo "S3_LANGUAGE=final-specs" >> $GITHUB_ENV |
56 | 65 | else |
57 | 66 | echo "S3_LANGUAGE=$sdk_name" >> $GITHUB_ENV |
58 | 67 | fi |
59 | | -
|
| 68 | + |
| 69 | + - name: Filter SPECIFICATION.md files for specs |
| 70 | + if: ${{ github.event.inputs.sdk_name == 'specs' }} |
| 71 | + run: | |
| 72 | + find ./scenarios -name "SPECIFICATION.md" | while read file; do |
| 73 | + mkdir -p "./filtered_specs/$(dirname "$file")" |
| 74 | + cp "$file" "./filtered_specs/$file" |
| 75 | + done |
| 76 | + |
| 77 | + - name: Clone and filter for coding standards |
| 78 | + if: ${{ github.event.inputs.sdk_name == 'coding-standards' }} |
| 79 | + run: | |
| 80 | + git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.wiki.git wiki-repo |
| 81 | + mkdir -p ./filtered-wiki |
| 82 | + find ./wiki-repo -type f -name "*[Gg]uidelines*.md" -o -name "*[Ss]tandards*.md" | while read file; do |
| 83 | + cp "$file" ./filtered-wiki/ |
| 84 | + done |
| 85 | + |
60 | 86 | - name: Extract and copy premium examples in temp. dir. |
| 87 | + if: ${{ contains(fromJSON('["javascriptv3","dotnetv4","javav2","rustv1","gov2","swift","python","ruby","php","cpp","kotlin"]'), github.event.inputs.sdk_name) }} |
61 | 88 | run: | |
62 | 89 | MARKDOWN_FILE="./$sdk_name/premium-ex.md" |
63 | 90 | |
@@ -99,14 +126,26 @@ jobs: |
99 | 126 | fi |
100 | 127 | done |
101 | 128 |
|
102 | | - - name: Upload/Sync to S3 |
| 129 | + - name: Upload/Sync to S3 (SDK languages) |
| 130 | + if: ${{ contains(fromJSON('["javascriptv3","dotnetv4","javav2","rustv1","gov2","swift","python","ruby","php","cpp","kotlin"]'), github.event.inputs.sdk_name) }} |
103 | 131 | run: | |
104 | 132 | for level in "basics" "feature-scenario" "complex-feature-scenario"; do |
105 | 133 | if [ -d "./extracted_snippets/$level" ]; then |
106 | 134 | aws s3 sync "./extracted_snippets/$level/" "s3://$S3_LANGUAGE-premium-bucket/$level/" --delete |
107 | 135 | echo "Uploaded $level examples to S3" |
108 | 136 | fi |
109 | 137 | done |
| 138 | + |
| 139 | + - name: Upload/Sync to S3 (Other directories) |
| 140 | + if: ${{ contains(fromJSON('["steering_docs","coding-standards","specs"]'), github.event.inputs.sdk_name) }} |
| 141 | + run: | |
| 142 | + if [ "$sdk_name" == "steering_docs" ]; then |
| 143 | + aws s3 sync "./$sdk_name/" "s3://$S3_LANGUAGE-bucket/" --delete |
| 144 | + elif [ "$sdk_name" == "coding-standards" ]; then |
| 145 | + aws s3 sync "./filtered-wiki/" "s3://$S3_LANGUAGE-bucket/" --delete |
| 146 | + else |
| 147 | + aws s3 sync "./filtered_specs/" "s3://$S3_LANGUAGE-bucket/" --delete |
| 148 | + fi |
110 | 149 |
|
111 | 150 | - name: Sync Knowledge Base Data Source |
112 | 151 | run: | |
|
0 commit comments