在GitHub Actions中压缩Git-LFS二进制文件并将其作为资产添加到发行版中? [英] Zipping Git-LFS binaries in GitHub Actions and adding them as asset to a release?
问题描述
我的GitHub存储库的简短故事是两个文件夹,其中包含文本(.tbx)和二进制文件(.png)的混合,我想使用工作流将它们压缩并作为资产添加到发行版中.zip内的文件已损坏,并且从很小的大小就可以看到它-预期的zip大小约为70mb,但小于1mb.
Long-story short part of my GitHub repository are two folders containing a mix of text (.tbx) and binaries (.png) which I would like to zip and add as assets to a release using workflows. The files inside the zip get corrupted and that's visible from a ridiculously small size - expected zip size around 70mb, but is less than 1mb.
我认为它与Git-LFS有关,但是对于Git-LFS和GitHub Actions来说是新手(以前从未使用过,所以从未使用过)是否可以压缩这些文件/文件夹?完全放弃Git-LFS?
这是我的GitHub Actions工作流代码的许多迭代之一:
Here is one of many iterations of my GitHub Actions workflow code:
on:
workflow_dispatch:
name: Upload Release Asset
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
zip -rn .png Buildings Resources/Buildings/
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Buildings.zip
asset_name: Buildings.zip
asset_content_type: application/zip
此处是包含上述代码的一小段代码,运行时没有存储-n'变成'放气'
推荐答案
我通过添加以下内容对其进行了修复
I have fixed it by adding the following
with:
lfs: 'true'
进入结帐代码"步骤,因此现在看起来像这样:
to the Checkout code step, so now it looks like this:
on:
workflow_dispatch:
name: Upload Release Asset
jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
lfs: 'true'
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
zip -r Resources Resources
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./Resources.zip
asset_name: Resources.zip
asset_content_type: application/zip
这篇关于在GitHub Actions中压缩Git-LFS二进制文件并将其作为资产添加到发行版中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!