-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #92 from vizzuhq/cicd
changed: refactor CICD
- Loading branch information
Showing
58 changed files
with
4,560 additions
and
4,562 deletions.
There are no files selected for viewing
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,66 @@ | ||
name: CD | ||
|
||
on: | ||
release: | ||
types: [published] | ||
workflow_call: | ||
|
||
jobs: | ||
publish: | ||
if: ${{ (github.event_name == 'release' && github.event.action == 'published') }} | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: node_modules_ubuntu22_${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Get workflow ID | ||
id: workflow_id | ||
run: | | ||
workflow_data=$(curl -s -X GET \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: Bearer ${{ secrets.VIZZUHQ_GITHUB_API }}" \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows") | ||
workflow_id=$(echo $workflow_data | jq -r '.workflows[] | select(.name == "CI-CD") | .id') | ||
echo "workflow_id=${workflow_id}" >> $GITHUB_OUTPUT | ||
- name: Get run ID | ||
id: run_id | ||
run: | | ||
run_data=$(curl -s -X GET \ | ||
-H "Accept: application/vnd.github.v3+json" \ | ||
-H "Authorization: Bearer ${{ secrets.VIZZUHQ_GITHUB_API }}" \ | ||
"https://api.github.com/repos/$GITHUB_REPOSITORY/actions/workflows/${{ steps.workflow_id.outputs.workflow_id }}/runs?branch=main") | ||
run_id=$(echo $run_data | jq -r '.workflow_runs[0].id') | ||
echo "run_id=${run_id}" >> $GITHUB_OUTPUT | ||
- name: Cache package | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
README.md | ||
build/ | ||
dist/ | ||
key: package_${{ steps.run_id.outputs.run_id }} | ||
|
||
- name: Publish package | ||
run: | | ||
npm config set registry=https://registry.npmjs.org/ | ||
npm config set //registry.npmjs.org/:_authToken=${NPM_API_TOKEN} | ||
npm publish | ||
env: | ||
NPM_API_TOKEN: ${{ secrets.NPM_API_TOKEN }} | ||
|
||
- name: Upload package | ||
run: | | ||
echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token | ||
gh release upload ${{ github.event.release.tag_name }} build/*tgz --clobber |
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,106 +1,106 @@ | ||
name: CI | ||
|
||
on: | ||
workflow_call: | ||
workflow_call: | ||
|
||
jobs: | ||
check_src: | ||
runs-on: ubuntu-22.04 | ||
|
||
env: | ||
PUPPETEER_CACHE_DIR: ${{ github.workspace }}/node_modules/.chromium | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache dev-js environment | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: cache_dev_js_ubuntu22_${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Format | ||
run: | | ||
npm run format-src | ||
- name: Lint | ||
run: | | ||
npm run lint-src | ||
- name: Type | ||
run: | | ||
npm run type-src | ||
- name: Test | ||
run: | | ||
npm test | ||
check_docs: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache dev-js environment | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: cache_dev_js_ubuntu22_${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Cache dev-py environment | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: cache_dev_py_ubuntu22_${{ hashFiles('pdm.lock') }} | ||
|
||
- name: Format | ||
run: | | ||
source .venv/bin/activate | ||
npm run format-docs | ||
- name: Lint | ||
run: | | ||
source .venv/bin/activate | ||
npm run lint-docs | ||
check_tools: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache dev-js environment | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: cache_dev_js_ubuntu22_${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Cache dev-py environment | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: cache_dev_py_ubuntu22_${{ hashFiles('pdm.lock') }} | ||
|
||
- name: Format | ||
run: | | ||
source .venv/bin/activate | ||
npm run format-tools | ||
- name: Lint | ||
run: | | ||
source .venv/bin/activate | ||
npm run lint-tools | ||
- name: Type | ||
run: | | ||
source .venv/bin/activate | ||
npm run type-tools | ||
check_src: | ||
runs-on: ubuntu-22.04 | ||
|
||
env: | ||
PUPPETEER_CACHE_DIR: ${{ github.workspace }}/node_modules/.chromium | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: node_modules_ubuntu22_${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Format | ||
run: | | ||
npm run format:src | ||
- name: Lint | ||
run: | | ||
npm run lint:src | ||
- name: Type | ||
run: | | ||
npm run type:src | ||
- name: Test | ||
run: | | ||
npm test | ||
check_docs: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: node_modules_ubuntu22_${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Cache venv | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv_ubuntu22_${{ hashFiles('pdm.lock') }} | ||
|
||
- name: Format | ||
run: | | ||
source .venv/bin/activate | ||
npm run format:docs | ||
- name: Lint | ||
run: | | ||
source .venv/bin/activate | ||
npm run lint:docs | ||
check_tools: | ||
runs-on: ubuntu-22.04 | ||
|
||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: node_modules_ubuntu22_${{ hashFiles('package-lock.json') }} | ||
|
||
- name: Cache venv | ||
uses: actions/cache@v3 | ||
with: | ||
path: .venv | ||
key: venv_ubuntu22_${{ hashFiles('pdm.lock') }} | ||
|
||
- name: Format | ||
run: | | ||
source .venv/bin/activate | ||
npm run format:tools | ||
- name: Lint | ||
run: | | ||
source .venv/bin/activate | ||
npm run lint:tools | ||
- name: Type | ||
run: | | ||
source .venv/bin/activate | ||
npm run type:tools |
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,24 +1,24 @@ | ||
name: CI-CD | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
|
||
jobs: | ||
init: | ||
uses: ./.github/workflows/init.yml | ||
init: | ||
uses: ./.github/workflows/init.yml | ||
|
||
ci: | ||
uses: ./.github/workflows/ci.yml | ||
needs: init | ||
ci: | ||
uses: ./.github/workflows/ci.yml | ||
needs: init | ||
|
||
doc: | ||
uses: ./.github/workflows/doc.yml | ||
needs: ci | ||
doc: | ||
uses: ./.github/workflows/doc.yml | ||
needs: ci | ||
|
||
release: | ||
uses: ./.github/workflows/release.yml | ||
secrets: inherit | ||
needs: doc | ||
cd: | ||
uses: ./.github/workflows/cd.yml | ||
secrets: inherit | ||
needs: doc |
Oops, something went wrong.