Skip to content

Commit 58c7bb4

Browse files
authored
ci: adds workflow scripts for publishing to dev/prod buckets (#587)
* ci: adds workflow scripts for publishing to dev/prod buckets * modifies aws region name variable
1 parent 929b589 commit 58c7bb4

3 files changed

Lines changed: 74 additions & 2 deletions

File tree

.github/workflows/publish_dev.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Upload schemas
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
upload-schemas:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write
12+
contents: read
13+
env:
14+
AWS_DATA_SCHEMA_ROLE: ${{ secrets.AWS_DATA_SCHEMA_ROLE_DEV }}
15+
AWS_DATA_SCHEMA_BUCKET: ${{ vars.AWS_DATA_SCHEMA_BUCKET_DEV }}
16+
AWS_REGION : ${{ vars.AWS_REGION_DEV }}
17+
SOURCE_DIR: 'schemas'
18+
steps:
19+
- uses: actions/checkout@master
20+
- name: Pull latest changes
21+
run: git pull origin main
22+
- name: Set up Python 3.8
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: 3.8
26+
- name: Configure aws credentials
27+
uses: aws-actions/configure-aws-credentials@v2
28+
with:
29+
role-to-assume: ${{ env.AWS_DATA_SCHEMA_ROLE }}
30+
role-session-name: github-schema-upload-session
31+
aws-region: ${{ env.AWS_REGION }}
32+
- name: Create and upload schemas
33+
run: |
34+
python -m pip install -e .
35+
python -m aind_data_schema.utils.json_writer --output $SOURCE_DIR --attach-version
36+
python -m pip install awscli
37+
aws s3 sync $SOURCE_DIR s3://${AWS_DATA_SCHEMA_BUCKET}/$SOURCE_DIR

.github/workflows/publish_prod.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Upload schemas
2+
on:
3+
push:
4+
branches:
5+
- main
6+
7+
jobs:
8+
upload-schemas:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
id-token: write
12+
contents: read
13+
env:
14+
AWS_DATA_SCHEMA_ROLE: ${{ secrets.AWS_DATA_SCHEMA_ROLE_PROD}}
15+
AWS_DATA_SCHEMA_BUCKET: ${{ vars.AWS_DATA_SCHEMA_BUCKET_PROD }}
16+
AWS_REGION : ${{ vars.AWS_REGION_PROD }}
17+
SOURCE_DIR: 'schemas'
18+
steps:
19+
- uses: actions/checkout@master
20+
- name: Pull latest changes
21+
run: git pull origin main
22+
- name: Set up Python 3.8
23+
uses: actions/setup-python@v3
24+
with:
25+
python-version: 3.8
26+
- name: Configure aws credentials
27+
uses: aws-actions/configure-aws-credentials@v2
28+
with:
29+
role-to-assume: ${{ env.AWS_DATA_SCHEMA_ROLE }}
30+
role-session-name: github-schema-upload-session
31+
aws-region: ${{ env.AWS_REGION }}
32+
- name: Create and upload schemas
33+
run: |
34+
python -m pip install -e .
35+
python -m aind_data_schema.utils.json_writer --output $SOURCE_DIR --attach-version
36+
python -m pip install awscli
37+
aws s3 sync $SOURCE_DIR s3://${AWS_DATA_SCHEMA_BUCKET}/$SOURCE_DIR

.github/workflows/tag.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@ jobs:
7070
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
7171
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7272
AWS_BUCKET_OLD: ${{ vars.AWS_BUCKET_OLD }}
73-
AWS_BUCKET_NEW: ${{ vars.AWS_BUCKET_NEW }}
7473
SOURCE_DIR: 'schemas'
7574
steps:
7675
- uses: actions/checkout@master
@@ -86,4 +85,3 @@ jobs:
8685
python -m aind_data_schema.utils.json_writer --output $SOURCE_DIR --attach-version
8786
python -m pip install awscli
8887
aws s3 sync $SOURCE_DIR s3://${AWS_BUCKET_OLD}/$SOURCE_DIR
89-
aws s3 sync $SOURCE_DIR s3://${AWS_BUCKET_NEW}/$SOURCE_DIR

0 commit comments

Comments
 (0)