By looking at some examples and experimenting, I succeeded in creating a GitHub Workflow Action that ignores .gitattributes and creates a .zip of the full repository when I create a release.
A problem is that the .zip has too many levels:
release-archive.zip
.... release-archive.zip
.... .... tmp/
.... .... .... tmp.YbXGREv3M9/
.... .... .... .... (repository files)
.github/workflows/create-release-archive.yml
name: Create Release Archive
on:
release:
types:
- created
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Archive repository
run: |
# Create a temporary directory
TMP_DIR=$(mktemp -d)
# Copy repository contents to the temporary directory, excluding specified files/directories
rsync -av --exclude={'.git', '.github'} . ${TMP_DIR}
# Create a ZIP archive
zip -r release-archive.zip ${TMP_DIR}
# Upload the ZIP archive as a GitHub Release asset
- name: Upload Release Asset
uses: actions/upload-artifact@v3
with:
name: release-archive.zip
path: ./release-archive.zip
Ideally, I'd like the name of the .zip to use the same convention that GitHub or the Asset Library uses when you download a .zip in the normal way, and for the .zip to contain one top-level directory that has that same name.
Also, the created .zip is not in an obvious place in the repo's page.