fix: deploy release pages via github pages
This commit is contained in:
52
.github/workflows/release-stable.yml
vendored
52
.github/workflows/release-stable.yml
vendored
@@ -733,7 +733,12 @@ jobs:
|
||||
needs: [version, release]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
concurrency:
|
||||
group: github-pages
|
||||
cancel-in-progress: false
|
||||
@@ -756,6 +761,9 @@ jobs:
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
@@ -784,41 +792,11 @@ jobs:
|
||||
cp _site/alpha/latest.json _site/latest.json
|
||||
cp _site/alpha/latest.json _site/latest-canary.json
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@e9c66a37f080288a11235e32cbe2dc5fb3a679cc
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./_site
|
||||
commit_message: "Update release history for ${{ needs.version.outputs.tag }}"
|
||||
path: ./_site
|
||||
|
||||
- name: Request and verify GitHub Pages rebuild
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
BUILD_URL=$(gh api --method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"repos/${{ github.repository }}/pages/builds" \
|
||||
--jq '.url')
|
||||
BUILD_ID="${BUILD_URL##*/}"
|
||||
if [ -z "$BUILD_ID" ]; then
|
||||
echo "::error::GitHub Pages rebuild request did not return a build id."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for attempt in {1..30}; do
|
||||
STATUS=$(gh api "repos/${{ github.repository }}/pages/builds/${BUILD_ID}" --jq '.status')
|
||||
echo "GitHub Pages build ${BUILD_ID} status: ${STATUS} (attempt ${attempt}/30)"
|
||||
case "$STATUS" in
|
||||
built)
|
||||
exit 0
|
||||
;;
|
||||
errored)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
sleep 10
|
||||
done
|
||||
|
||||
echo "::error::GitHub Pages build ${BUILD_ID} did not finish within 5 minutes."
|
||||
exit 1
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
52
.github/workflows/release.yml
vendored
52
.github/workflows/release.yml
vendored
@@ -779,7 +779,12 @@ jobs:
|
||||
needs: [version, release]
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
concurrency:
|
||||
group: github-pages
|
||||
cancel-in-progress: false
|
||||
@@ -802,6 +807,9 @@ jobs:
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Setup Pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Install dependencies
|
||||
run: pnpm install --frozen-lockfile
|
||||
|
||||
@@ -830,41 +838,11 @@ jobs:
|
||||
cp _site/alpha/latest.json _site/latest.json
|
||||
cp _site/alpha/latest.json _site/latest-canary.json
|
||||
|
||||
- name: Deploy to GitHub Pages
|
||||
uses: peaceiris/actions-gh-pages@e9c66a37f080288a11235e32cbe2dc5fb3a679cc
|
||||
- name: Upload Pages artifact
|
||||
uses: actions/upload-pages-artifact@v4
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./_site
|
||||
commit_message: "Update release history for ${{ needs.version.outputs.tag }}"
|
||||
path: ./_site
|
||||
|
||||
- name: Request and verify GitHub Pages rebuild
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
BUILD_URL=$(gh api --method POST \
|
||||
-H "Accept: application/vnd.github+json" \
|
||||
-H "X-GitHub-Api-Version: 2022-11-28" \
|
||||
"repos/${{ github.repository }}/pages/builds" \
|
||||
--jq '.url')
|
||||
BUILD_ID="${BUILD_URL##*/}"
|
||||
if [ -z "$BUILD_ID" ]; then
|
||||
echo "::error::GitHub Pages rebuild request did not return a build id."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for attempt in {1..30}; do
|
||||
STATUS=$(gh api "repos/${{ github.repository }}/pages/builds/${BUILD_ID}" --jq '.status')
|
||||
echo "GitHub Pages build ${BUILD_ID} status: ${STATUS} (attempt ${attempt}/30)"
|
||||
case "$STATUS" in
|
||||
built)
|
||||
exit 0
|
||||
;;
|
||||
errored)
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
sleep 10
|
||||
done
|
||||
|
||||
echo "::error::GitHub Pages build ${BUILD_ID} did not finish within 5 minutes."
|
||||
exit 1
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
|
||||
Reference in New Issue
Block a user