optimize static param ID storing for getAllContents #295
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
name: Build and deploy to Kuroco front | |
on: | |
push: | |
branches: | |
- main | |
issue_comment: | |
types: [created, edited] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
# for Pull Request (exclude merged) | |
pullreq_build: | |
name: Build(pullreq) | |
if: (github.repository == 'diverta/front_next_media' && github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '/kuroco stage') && github.event.issue.pull_request != null) | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Get branch name and sha" | |
id: get_branch | |
run: | | |
PR=$(curl -H "X-Kuroco-Auth: token de396df5ef2cadeccd5e053c2975a9f0" https://dev-next-media.g.kuroco.app/direct/menu/github/?pr=${{ github.event.issue.pull_request.url }}) | |
echo "branch=$(echo $PR | jq -r '.ref')" >> $GITHUB_OUTPUT | |
echo "sha=$(echo $PR | jq -r '.sha')" >> $GITHUB_OUTPUT | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ steps.get_branch.outputs.branch }} | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- name: CI Cache | |
uses: actions/cache@v4 | |
id: node_modules_cache_id | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ steps.get_branch.outputs.branch }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }} | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Zip artifact for upload | |
run: cd out && zip ../out.zip . -r | |
- name: Archive Production Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.get_branch.outputs.sha }}-${{ github.run_id }} | |
path: out.zip | |
retention-days: 7 | |
- name: Wait for Artifact download | |
run: sleep 15 | |
- name: Webhook | |
uses: diverta/workflow-webhook@v3 | |
env: | |
webhook_url: "https://dev-next-media.g.kuroco.app/direct/menu/github/" | |
webhook_secret: "de396df5ef2cadeccd5e053c2975a9f0" | |
data: '{"single_zip":"1","domain":"dev-next-media.g.kuroco-front.app","pr":"${{ github.event.issue.pull_request.url }}", "repository":"${{ github.repository }}", "run_id":"${{ github.run_id }}", "hash":"${{ steps.get_branch.outputs.sha }}"}' | |
#for Push | |
pushed_build: | |
name: Build(pushed) | |
if: (github.repository == 'diverta/front_next_media' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18.x' | |
- name: CI Cache | |
uses: actions/cache@v4 | |
id: node_modules_cache_id | |
env: | |
cache-name: cache-node-modules | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ env.BRANCH }}-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependencies | |
if: ${{ steps.node_modules_cache_id.outputs.cache-hit != 'true' }} | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Zip artifact for upload | |
run: cd out && zip ../out.zip . -r | |
- name: Archive Production Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ github.sha }}-${{ github.run_id }} | |
path: out.zip | |
retention-days: 7 | |
- name: Webhook | |
uses: diverta/workflow-webhook@v3 | |
env: | |
webhook_url: "https://dev-next-media.g.kuroco.app/direct/menu/github/" | |
webhook_secret: "de396df5ef2cadeccd5e053c2975a9f0" | |
data: '{"single_zip":"1","domain":"dev-next-media.g.kuroco-front.app","pr":"${{ github.event.issue.pull_request.url }}", "repository":"${{ github.repository }}", "run_id":"${{ github.run_id }}", "hash":"${{ github.sha }}"}' |