New fs-v2 #7
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 Release Zip | |
| on: | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Triggers the workflow on push events to the main branch | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| # Creates a temporary directory excluding files from .distignore and zips it | |
| - name: Create zip file | |
| run: | | |
| if [ -f ".distignore" ]; then | |
| # Create a temporary directory to hold the files to be zipped | |
| mkdir release_temp | |
| # Use rsync to copy files, excluding those in .distignore | |
| rsync -a --exclude-from=.distignore ./ release_temp/ | |
| # Zip the contents of the temporary directory | |
| cd release_temp && zip -r ../release.zip . && cd .. | |
| else | |
| # If .distignore doesn't exist, zip everything | |
| zip -r release.zip . | |
| fi | |
| # Commits the release.zip file back to your repository | |
| - name: Commit and push zip file | |
| uses: stefanzweifel/git-auto-commit-action@v4 | |
| with: | |
| commit_message: "chore: add/update release.zip" | |
| file_pattern: release.zip | |
| commit_user_name: GitHub Actions | |
| commit_user_email: actions@github.com | |
| commit_author: Author <actions@github.com> |