On-Demand Zip Release #4
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: On-Demand Zip Release | |
| permissions: | |
| contents: write | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: 'Release tag (e.g., v1.0.0)' | |
| required: true | |
| default: 'v1.0.0' | |
| release_name: | |
| description: 'Release name' | |
| required: false | |
| default: 'Manual Release' | |
| release_body: | |
| description: 'Release description' | |
| required: false | |
| default: 'Automated .zip releases for libs/ packages.' | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Zip each directory in libs/ | |
| run: | | |
| mkdir zips | |
| for dir in libs/*/ ; do | |
| d=$(basename "$dir") | |
| zip -r "zips/${d}.zip" "$dir" | |
| done | |
| - name: List zip files | |
| run: ls -lh zips/ | |
| - name: Create tag if it does not exist | |
| run: | | |
| git fetch --tags | |
| if ! git rev-parse "refs/tags/${{ github.event.inputs.release_tag }}" >/dev/null 2>&1; then | |
| git config user.name "github-actions" | |
| git config user.email "[email protected]" | |
| git tag ${{ github.event.inputs.release_tag }} | |
| git push origin ${{ github.event.inputs.release_tag }} | |
| fi | |
| - name: Create Release & Upload zips | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.event.inputs.release_tag }} | |
| name: ${{ github.event.inputs.release_name }} | |
| body: ${{ github.event.inputs.release_body }} | |
| files: zips/*.zip | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |