Create tar.gz Folders for Latest Release #21
This file contains hidden or 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
# .github/workflows/create-release-zips.yml | |
name: Zip Folders to Release | |
on: | |
workflow_dispatch: | |
# Thêm một ô nhập liệu khi chạy workflow thủ công | |
inputs: | |
tag_name: | |
description: 'Nhập tên tag của release (ví dụ: v1.0.0)' | |
required: true | |
type: string | |
jobs: | |
build-and-upload: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Zip individual folders | |
run: | | |
for dir in */; do | |
dirname="${dir%/}" | |
if [ "$dirname" == ".github" ]; then | |
echo "Skipping .github directory..." | |
continue | |
fi | |
echo "Zipping '$dirname'..." | |
zip -r "${dirname}.zip" "$dirname" -x "*/README.md" | |
done | |
# SỬA Ở ĐÂY: Sử dụng tag name từ input thay vì 'latest' | |
- name: Upload zip files to specified release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ github.event.inputs.tag_name }} *.zip --clobber | |
echo "✅ Đã tải tệp lên release '${{ github.event.inputs.tag_name }}'." |