fix(file-tree): 不存在的文件意味着该目标架构下的所有仓库没有检查出错误 #171
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: Docker Image CI | |
on: | |
push: | |
branches: [ main, ui/* ] | |
env: | |
IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/os-checker:latest | |
IMAGE_TAR: /tmp/os-checker.tar | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Create and boot a builder using by default the docker-container driver. | |
# This is not required but recommended using it to be able to build multi-platform images, export cache, etc. | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
tags: ${{ env.IMAGE }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
outputs: type=docker,dest=${{ env.IMAGE_TAR }} | |
- name: Load and Run Docker image | |
run: | | |
docker load --input ${{ env.IMAGE_TAR }} | |
docker image ls -a | |
# DEBUG means compiling os-checker from source | |
docker run -e DEBUG=1 -v /check:/check ${{ env.IMAGE }} | |
# - name: Display the result of os-checker | |
# run: cat /check/summary.txt >> $GITHUB_STEP_SUMMARY | |
- name: Upload pages artifacts | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: /check/dist/ | |
- name: Commit and push test.json | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# author zjp-CN, and commiter bot | |
git config --global user.name "zjp-CN" | |
git config --global user.email "[email protected]" | |
git config --global committer.name "zjp-CN[bot]" | |
git config --global committer.email "zjp-CN[bot]@users.noreply.github.com" | |
echo "正在 clone os-checker/database" | |
git clone https://x-access-token:${{ secrets.ACCESS_TOKEN }}@github.com/os-checker/database.git | |
echo "成功 clone os-checker/database" | |
cd database | |
git pull --rebase # 防止二次运行 CI 时落后于远程分支 | |
export BOT=1 UI_JSON=ui.json # database 仓库的 json 检查结果 | |
cp /check/test.json $UI_JSON | |
# 运行 jq 生成 WebUI 所需的 JSON 文件,并推送到 database 仓库 | |
sh ci.sh | |
# Deploy job | |
deploy: | |
# Add a dependency to the build job | |
needs: build | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
# Specify runner + deployment step | |
runs-on: ubuntu-latest | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 # or specific "vX.X.X" version tag for this action |