Create tar.gz Folders for Latest Release #28
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
name: Create tar.gz Archives for Release | |
on: | |
workflow_dispatch: | |
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: Tạo file .tar.gz từ từng thư mục | |
run: | | |
for dir in */; do | |
dirname="${dir%/}" | |
if [ "$dirname" == ".github" ]; then | |
echo "⏩ Bỏ qua thư mục .github" | |
continue | |
fi | |
echo "📦 Đang tạo '${dirname}.tar.gz'..." | |
tar --exclude="${dirname}/README.md" -czf "${dirname}.tar.gz" "$dirname" | |
done | |
- name: Tải file .tar.gz lên release theo tag đã chọn | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload ${{ github.event.inputs.tag_name }} *.tar.gz --clobber | |
echo "✅ Đã tải tệp .tar.gz lên release '${{ github.event.inputs.tag_name }}'." |