Skip to content

Commit

Permalink
feat: aliyun esa purge
Browse files Browse the repository at this point in the history
  • Loading branch information
eallion committed Oct 29, 2024
1 parent 5976658 commit 1f20d70
Show file tree
Hide file tree
Showing 4 changed files with 1,700 additions and 250 deletions.
109 changes: 58 additions & 51 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,49 +45,49 @@ jobs:
run: |
hugo --minify --enableGitInfo
# - name: Install pnpm
# uses: pnpm/action-setup@v4
# with:
# version: 9
# run_install: false

# - name: Setup Node LTS
# uses: actions/setup-node@v4
# with:
# node-version: 20.x
# cache: 'pnpm'
# cache-dependency-path: '**/pnpm-lock.yaml'

# - name: Install and run Shiki
# run: |
# export NODE_OPTIONS="--max_old_space_size=7168"
# pnpm install
# pnpm run shiki --silent || true
# # npx rehype-cli public -o --silent || true

# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v4
# with:
# personal_token: ${{ secrets.personal_token }}
# external_repository: eallion/blog
# publish_branch: main
# publish_dir: ./public
# # destination_dir: public
# allow_empty_commit: true
# # commit_message: ${{ GitHub.event.head_commit.message }}
# full_commit_message: ${{ github.event.head_commit.message }}
# #cname: eallion.com
# force_orphan: true
# user_name: 'github-actions[bot]'
# user_email: 'github-actions[bot]@users.noreply.github.com'
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

# - name: Publish to Cloudflare Pages
# uses: cloudflare/wrangler-action@v3
# with:
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# quiet: true
# command: pages deploy public --project-name=${{ secrets.CLOUDFLARE_PROJECT_NAME }} --commit-dirty=true
- name: Setup Node LTS
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
cache-dependency-path: '**/pnpm-lock.yaml'

# - name: Install and run Shiki
# run: |
# export NODE_OPTIONS="--max_old_space_size=7168"
# pnpm install
# pnpm run shiki --silent || true
# # npx rehype-cli public -o --silent || true
#
# - name: Deploy to GitHub Pages
# uses: peaceiris/actions-gh-pages@v4
# with:
# personal_token: ${{ secrets.personal_token }}
# external_repository: eallion/blog
# publish_branch: main
# publish_dir: ./public
# # destination_dir: public
# allow_empty_commit: true
# # commit_message: ${{ GitHub.event.head_commit.message }}
# full_commit_message: ${{ github.event.head_commit.message }}
# #cname: eallion.com
# force_orphan: true
# user_name: 'github-actions[bot]'
# user_email: 'github-actions[bot]@users.noreply.github.com'
#
# - name: Publish to Cloudflare Pages
# uses: cloudflare/wrangler-action@v3
# with:
# apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
# accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# quiet: true
# command: pages deploy public --project-name=${{ secrets.CLOUDFLARE_PROJECT_NAME }} --commit-dirty=true

- name: Aliyun Actions Docker image degest
run: |
Expand All @@ -114,12 +114,19 @@ jobs:
SKIP_SETTING: true
INCREMENTAL: true

- name: Refresh volcengine CDN
run: |
curl -s "https://api.github.com/repos/volcengine/volcengine-cli/releases/latest" | grep "browser_download_url.*linux_amd64.zip" | cut -d : -f 2,3 | tr -d \" | wget -O ve.zip -qi -
unzip -q ve.zip > /dev/null 2>&1
chmod a+x ./ve
./ve configure set --profile volcengine-hugo-github-actions --region cn-beijing --endpoint cdn.volcengineapi.com --access-key ${{ secrets.VOLC_ACCESS_KEY }} --secret-key ${{ secrets.VOLC_SECRET_KEY }}
./ve cdn SubmitRefreshTask --body '{"Type":"dir","Urls":"https://www.eallion.com/"}' > /dev/null 2>&1 || true
# - name: Refresh volcengine CDN
# run: |
# curl -s "https://api.github.com/repos/volcengine/volcengine-cli/releases/latest" | grep "browser_download_url.*linux_amd64.zip" | cut -d : -f 2,3 | tr -d \" | wget -O ve.zip -qi -
# unzip -q ve.zip > /dev/null 2>&1
# chmod a+x ./ve
#
# ./ve configure set --profile volcengine-hugo-github-actions --region cn-beijing --endpoint cdn.volcengineapi.com --access-key ${{ secrets.VOLC_ACCESS_KEY }} --secret-key ${{ secrets.VOLC_SECRET_KEY }}
#
# ./ve cdn SubmitRefreshTask --body '{"Type":"dir","Urls":"https://www.eallion.com/"}' > /dev/null 2>&1 || true

- name: Refresh Aliyun ESA
run: pnpm run esa
env:
ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY_ID }}
ACCESS_KEY_SECRET: ${{ secrets.ACCESS_KEY_SECRET }}
ESA_SITE_ID: ${{ secrets.ESA_SITE_ID }}
26 changes: 19 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"scripts": {
"dev": "cd themes/blowfish && npm install && cd ../.. && set NODE_ENV=development && node ./themes/blowfish/node_modules/tailwindcss/lib/cli.js -c ./themes/blowfish/tailwind.config.js -i ./themes/blowfish/assets/css/main.css -o ./assets/css/compiled/main.css --jit -w",
"build": "cd themes/blowfish && npm install && cd ../.. && set NODE_ENV=production&&node ./themes/blowfish/node_modules/tailwindcss/lib/cli.js -c ./themes/blowfish/tailwind.config.js -i ./themes/blowfish/assets/css/main.css -o ./assets/css/compiled/main.css --jit",
"esa": "node scripts/esa-purge.js",
"hns": "net stop hns && net start hns",
"hugo": "hugo --minify --enableGitInfo",
"new": "node scripts/new_post.js",
"prepare": "husky",
Expand All @@ -15,8 +17,7 @@
"shiki": "npx rehype-cli public -o",
"theme": "git submodule update --remote --merge",
"vercel": "node scripts/vercel_env_hugo_version.js && hugo --minify --enableGitInfo && next build",
"winnat": "net stop winnat -y && net start winnat -y",
"hns": "net stop hns && net start hns"
"winnat": "net stop winnat -y && net start winnat -y"
},
"repository": {
"type": "git",
Expand All @@ -34,14 +35,25 @@
"url": "https://github.com/eallion/eallion.com/issues"
},
"homepage": "https://github.com/eallion/eallion.com#readme",
"devDependencies": {
"@types/node": "^20.17.2",
"nyc": "^15.1.0",
"source-map-support": "^0.5.21",
"ts-node": "^8.10.2",
"typescript": "^3.9.10"
},
"dependencies": {
"@shikijs/rehype": "^1.16.1",
"@types/node": "^20.16.3",
"@alicloud/esa20240910": "2.5.0",
"@alicloud/openapi-client": "^0.4.12",
"@alicloud/tea-console": "^1.0.0",
"@alicloud/tea-typescript": "^1.8.0",
"@alicloud/tea-util": "^1.4.9",
"@shikijs/rehype": "^1.22.2",
"axios": "^1.7.7",
"dotenv": "^16.4.5",
"fs": "0.0.1-security",
"husky": "^9.1.5",
"rehype-cli": "^12.0.0",
"shiki": "^1.16.1"
"husky": "^9.1.6",
"rehype-cli": "^12.0.1",
"shiki": "^1.22.2"
}
}
Loading

0 comments on commit 1f20d70

Please sign in to comment.