-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(structure)!: change paths (#30)
- Loading branch information
1 parent
c15b165
commit cb755af
Showing
32 changed files
with
8,922 additions
and
191 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,30 @@ | ||
Fixes # | ||
## Description of your changes | ||
|
||
<!--- | ||
Include here a summary of the change. | ||
Please include also relevant motivation and context. | ||
Add any applicable code snippets, links, screenshots, or other resources | ||
that can help us verify your changes. | ||
--> | ||
|
||
### Related issues, RFCs | ||
|
||
<!--- | ||
Add here the number (i.e. #42) to the Github Issue or RFC that is related to this PR. | ||
Don't include any other text, otherwise the Github Issue will not be detected. | ||
Note: If no issue is present the PR might get blocked and not be reviewed. | ||
--> | ||
**Issue number:** | ||
|
||
## Checklist | ||
|
||
- [ ] I have performed a *self-review* of my own code | ||
- [ ] I have *commented* my code where necessary, particularly in areas that should be flagged with a TODO, or hard-to-understand areas | ||
- [ ] I have made corresponding changes to the *documentation* | ||
- [ ] My changes generate *no new warnings* | ||
- [ ] I have *added tests* that prove my change is effective and works | ||
- [ ] The PR title follows the [conventional commit semantics](https://github.com/neulabscom/neulabs-cdk-constructs/blob/main/.github/semantic.yml#L2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/usr/bin/python3 | ||
import argparse | ||
import os | ||
import shlex | ||
import subprocess | ||
import sys | ||
|
||
DEFAULT_BUCKET = 'neulabs-docs-swamp' | ||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--base-path', type=str, default='docs/') | ||
parser.add_argument( | ||
'--docs-name', type=str, default='docs', help='Docs folder name' | ||
) | ||
parser.add_argument('--project-name', type=str, required=True) | ||
parser.add_argument('--paths', type=str, nargs='+', default=[]) | ||
|
||
args = parser.parse_args() | ||
|
||
if not os.path.isdir(args.base_path): | ||
sys.tracebacklimit = 0 | ||
raise NotADirectoryError(f'"{args.base_path}" is not a directory') | ||
|
||
folders_to_upload = [ | ||
(os.path.join(args.base_path, 'static', 'img'), ['neulabs/*']), | ||
(os.path.join(args.base_path, 'src', 'components'), []), | ||
(os.path.join(args.base_path, 'src', 'css'), []), | ||
(os.path.join(args.base_path, args.docs_name), []), | ||
(os.path.join(args.base_path, 'sidebars.js'), []), | ||
] | ||
for path in args.paths: | ||
if os.path.isdir(path): | ||
folders_to_upload.append((path, [])) | ||
continue | ||
else: | ||
sys.tracebacklimit = 0 | ||
raise NotADirectoryError(f'"{path}" is not a directory') | ||
|
||
s3_base_path = f's3://{DEFAULT_BUCKET}/{args.project_name}/' | ||
|
||
for folder, exclude in folders_to_upload: | ||
s3_path = os.path.join(s3_base_path, folder.replace(args.base_path, '')) | ||
exclude_path = ' '.join([f'--exclude="{e}"' for e in exclude]) | ||
if os.path.isdir(folder): | ||
cmd = f'aws s3 sync {folder} {s3_path} --delete {exclude_path}' | ||
else: | ||
cmd = f'aws s3 cp {folder} {s3_path}' | ||
|
||
print(f'Upload {folder} to {s3_path}') | ||
print(subprocess.check_output(shlex.split(cmd)).decode('utf-8')) | ||
|
||
return 0 | ||
|
||
|
||
if __name__ == '__main__': | ||
sys.exit(main()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
name: Deploy Docs | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'docs/**' | ||
|
||
env: | ||
PROJECT_NAME: "neulabs-cdk-constructs" | ||
AWS_REGION: "eu-west-1" | ||
AWS_ROLE_NAME: 'github-oidc-workflow-role' | ||
|
||
permissions: | ||
id-token: write | ||
contents: read # This is required for actions/checkout | ||
|
||
jobs: | ||
trigger-workflow: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Git clone the repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Configure aws credentials | ||
uses: aws-actions/configure-aws-credentials@v2 | ||
with: | ||
role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ env.AWS_ROLE_NAME }} | ||
aws-region: ${{ env.AWS_REGION }} | ||
mask-aws-account-id: no | ||
|
||
- name: Upload docs to S3 bucket | ||
run: | | ||
python3 .github/scripts/upload_docs.py --project-name ${{ env.PROJECT_NAME }} | ||
- name: Trigger deploy workflow in neulbas-docs Repository | ||
uses: actions/github-script@v6 | ||
with: | ||
github-token: ${{ secrets.NEULABS_MANAGE_ACTION_WORKFLOWS }} | ||
retries: 3 | ||
script: | | ||
const owner = 'neulabscom'; | ||
const repo = 'neulabs-docs'; | ||
const event_type = 'deploy'; | ||
const ref = 'main'; | ||
github.rest.repos.createDispatchEvent({ | ||
owner, | ||
repo, | ||
event_type, | ||
client_payload: { | ||
"project_name": process.env.PROJECT_NAME | ||
} | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,4 +27,8 @@ Setup env: | |
|
||
## Pull Requests | ||
|
||
...in progress | ||
1. This project uses >= [email protected] and [email protected] for development | ||
2. Before opening a Pull Request, please find the existing related issue or open a new one to discuss the proposed changes. A PR without a related issue or discussion has a high risk of being rejected. We are very appreciative and thankful for your time and efforts, and we want to make sure they are not wasted. | ||
3. After your proposal has been reviewed and accepted by at least one of the project's maintainers, you can submit a pull request. | ||
4. When opening a PR, make sure to follow the checklist inside the pull request template. | ||
|
Oops, something went wrong.