Gmeek 构建失败?自己更新requipment?修改yaml即可
Gmeek 构建失败?自己更新requipment?修改yaml即可
问题描述
当我们使用 Gmeek 构建 GitHub Pages 时,可能会遇到构建失败的问题。这种情况下,我们需要自己更新 equipment 以解决问题。然而,这个过程可能会很麻烦。因此,在本文中,我们将介绍如何修改 yaml 文件来解决这个问题。
修改yaml
要修改 yaml 文件,我们需要找到以下代码:
name: build Gmeek
on:
workflow_dispatch:
issues:
types: [opened, edited]
schedule:
- cron: "0 16 * * *"
jobs:
build:
name: Generate blog
runs-on: ubuntu-20.04 # 修改为 22.04
if: ${{ github.event.repository.owner.id == github.event.sender.id || github.event_name == 'schedule' }}
permissions: write-all
steps:
...
我们需要修改 runs-on
的值,从 ubuntu-20.04
更新到 ubuntu-22.04
。
修改后的yaml
修改后的 yaml 文件如下:
name: build Gmeek
on:
workflow_dispatch:
issues:
types: [opened, edited]
schedule:
- cron: "0 16 * * *"
jobs:
build:
name: Generate blog
runs-on: ubuntu-22.04 # 修改为 22.04
if: ${{ github.event.repository.owner.id == github.event.sender.id || github.event_name == 'schedule' }}
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Get config.json
run: |
echo "====== check config.josn file ======"
cat config.json
echo "====== check config.josn end ======"
sudo apt-get install jq
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Clone source code
run: |
GMEEK_VERSION=$(jq -r ".GMEEK_VERSION" config.json)
git clone https://github.com/Meekdai/Gmeek.git /opt/Gmeek;
cd /opt/Gmeek/
lastTag=$(git describe --tags `git rev-list --tags --max-count=1`)
if [ $GMEEK_VERSION == 'last' ]; then git checkout $lastTag; else git checkout $GMEEK_VERSION; fi;
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r /opt/Gmeek/requirements.txt
- name: Generate new html
run: |
cp -r ./* /opt/Gmeek/
cd /opt/Gmeek/
python Gmeek.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} --issue_number '${{ github.event.issue.number }}'
cp -a /opt/Gmeek/docs ${{ github.workspace }}
cp -a /opt/Gmeek/backup ${{ github.workspace }}
cp /opt/Gmeek/blogBase.json ${{ github.workspace }}
- name: update html
run: |
git config --local user.email "$(jq -r ".email" config.json)"
git config --local user.name "${{ github.repository_owner }}"
git add .
git commit -a -m '🎉auto update by Gmeek action' || echo "nothing to commit"
git push || echo "nothing to push"
sleep 3
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/.'
deploy:
name: Deploy blog
runs-on: ubuntu-22.04 # 修改为 22.04
needs: build
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
总结
通过修改 yaml 文件,我们可以解决 Gmeek 构建失败的问题。我们需要修改 runs-on
的值,从 ubuntu-20.04
更新到 ubuntu-22.04
。这样我们就可以使用最新的 equipment 来解决问题。
Gmeek 构建失败?自己更新requipment?修改yaml即可
问题描述
当我们使用 Gmeek 构建 GitHub Pages 时,可能会遇到构建失败的问题。这种情况下,我们需要自己更新 equipment 以解决问题。然而,这个过程可能会很麻烦。因此,在本文中,我们将介绍如何修改 yaml 文件来解决这个问题。
修改yaml
要修改 yaml 文件,我们需要找到以下代码:
name: build Gmeek
on:
workflow_dispatch:
issues:
types: [opened, edited]
schedule:
- cron: "0 16 * * *"
jobs:
build:
name: Generate blog
runs-on: ubuntu-20.04 # 修改为 22.04
if: ${{ github.event.repository.owner.id == github.event.sender.id || github.event_name == 'schedule' }}
permissions: write-all
steps:
...
我们需要修改 runs-on
的值,从 ubuntu-20.04
更新到 ubuntu-22.04
。
修改后的yaml
修改后的 yaml 文件如下:
name: build Gmeek
on:
workflow_dispatch:
issues:
types: [opened, edited]
schedule:
- cron: "0 16 * * *"
jobs:
build:
name: Generate blog
runs-on: ubuntu-22.04 # 修改为 22.04
if: ${{ github.event.repository.owner.id == github.event.sender.id || github.event_name == 'schedule' }}
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Get config.json
run: |
echo "====== check config.josn file ======"
cat config.json
echo "====== check config.josn end ======"
sudo apt-get install jq
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Clone source code
run: |
GMEEK_VERSION=$(jq -r ".GMEEK_VERSION" config.json)
git clone https://github.com/Meekdai/Gmeek.git /opt/Gmeek;
cd /opt/Gmeek/
lastTag=$(git describe --tags `git rev-list --tags --max-count=1`)
if [ $GMEEK_VERSION == 'last' ]; then git checkout $lastTag; else git checkout $GMEEK_VERSION; fi;
- name: Install dependencies
run: |
pip install --upgrade pip
pip install -r /opt/Gmeek/requirements.txt
- name: Generate new html
run: |
cp -r ./* /opt/Gmeek/
cd /opt/Gmeek/
python Gmeek.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} --issue_number '${{ github.event.issue.number }}'
cp -a /opt/Gmeek/docs ${{ github.workspace }}
cp -a /opt/Gmeek/backup ${{ github.workspace }}
cp /opt/Gmeek/blogBase.json ${{ github.workspace }}
- name: update html
run: |
git config --local user.email "$(jq -r ".email" config.json)"
git config --local user.name "${{ github.repository_owner }}"
git add .
git commit -a -m '🎉auto update by Gmeek action' || echo "nothing to commit"
git push || echo "nothing to push"
sleep 3
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'docs/.'
deploy:
name: Deploy blog
runs-on: ubuntu-22.04 # 修改为 22.04
needs: build
permissions:
contents: write
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Q&A
Q: 为什么需要修改yaml文件?
A: 因为 Gmeek 构建失败,需要更新 equipment 以解决问题。
Q: 如何修改yaml文件?
A: 需要找到 runs-on
的值,从 ubuntu-20.04
更新到 ubuntu-22.04
。
Q: 修改yaml文件后,需要做什么?
A: 需要保存修改后的yaml文件,并重新运行 Gmeek 构建。
Q: 如果修改yaml文件后,仍然遇到问题?
A: 可以尝试重新检查yaml文件,确保修改正确,并重新运行 Gmeek 构建。
总结
通过修改 yaml 文件,我们可以解决 Gmeek 构建失败的问题。我们需要修改 runs-on
的值,从 ubuntu-20.04
更新到 ubuntu-22.04
。这样我们就可以使用最新的 equipment 来解决问题。