Merge pull request #31 from chun-awa/main

Use github pages as artifact output
This commit is contained in:
LIPiston 2024-10-09 17:41:59 +08:00 committed by GitHub
commit 7c91db8229
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 161 additions and 163 deletions

View File

@ -7,18 +7,25 @@ on:
pull_request:
branches:
- main # 当对 main 分支创建 PR 时触发
permissions:
contents: write # 允许对代码库的写入权限
workflow_dispatch:
jobs:
run-script:
permissions:
contents: write # 允许对代码库的写入权限
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest # 使用最新的 Ubuntu 运行环境
steps:
- name: Checkout repository
uses: actions/checkout@v3 # 检出当前仓库代码
uses: actions/checkout@v4 # 检出当前仓库代码
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.x' # 设置 Python 版本
@ -29,26 +36,14 @@ jobs:
- name: Run image stitching script
run: |
python auto_pack_img.py # 运行你的 Python 脚本(替换为你的脚本文件名)
mkdir images
./auto_pack_img.py
- name: Save stitched image as artifact
uses: actions/upload-artifact@v3
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
name: auto_img_zh_cn # 上传生成的图片作为 artifact
path: auto_img_zh_cn.png # 替换为你生成图片的路径
path: images
- name: Save stitched image as artifact
uses: actions/upload-artifact@v3
with:
name: auto_img_en # 上传生成的图片作为 artifact
path: auto_img_en.png # 替换为你生成图片的路径
- name: Commit and push updated file
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add auto_img_zh_cn.png # 添加你想要提交的文件
git add auto_img_en.png
git commit -m "Update file with new data"
git push origin main # 推送更改回 main 分支
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # 使用 GitHub 提供的 Token 推送更改
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

View File

@ -1,15 +1,17 @@
# mcmeme
欢迎各位提交[Pull Request](https://github.com/LIPiston/mcmeme/pulls)来扩展这张图
![](latest.png)
Pull Request的时候提交小图即可 大图太容易冲突了
## 自动生成的大图
![](auto_img_zh_cn.png)
![](auto_img_en.png)
[QQ群](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=GSK0q5Be9BtgPh-7UDEgw1XUc9eNlb_E&authKey=s54nZ9lIbjETFV2sQj65vJHoH04tg%2Bst%2FB%2Fo0WgVTyRGo%2BxL0ZPw8%2BHX3oNnr%2FIo&noverify=0&group_code=810025413)
![](latest.png)
## 自动生成的大图
![](https://lipiston.github.io/mcmeme/auto_img_zh_cn.png)
![](https://lipiston.github.io/mcmeme/auto_img_en.png)
## 梦开始的地方
### 原创

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 MiB

5
auto_pack_img.py Normal file → Executable file
View File

@ -1,3 +1,4 @@
#!/usr/bin/env python3
import random
import cv2
@ -123,7 +124,7 @@ images = load_images_from_folder(folder)
stitched_image = stitch_images_bin_packing(images)
cv2.imwrite('auto_img_zh_cn.png', stitched_image)
cv2.imwrite('images/auto_img_zh_cn.png', stitched_image)
folder = 'en'
@ -132,4 +133,4 @@ images = load_images_from_folder(folder)
stitched_image = stitch_images_bin_packing(images)
cv2.imwrite('auto_img_en.png', stitched_image)
cv2.imwrite('images/auto_img_en.png', stitched_image)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB