Skip to content

Version 1.0

Version 1.0 #3

Workflow file for this run

name: Package release
on:
workflow_dispatch:
release:
types: [published]
jobs:
package:
runs-on: ubuntu-latest
env:
SOURCE_FOLDER: "./weidu_context_menu"
steps:
- name: Check out repository
uses: actions/checkout@v7
- name: Prepare and package folder
shell: bash
run: |
set -euo pipefail
source="${SOURCE_FOLDER%/}"
folder_name="$(basename "$source")"
# For a published release, use its tag/label. For manual runs,
# use the tag if supplied by the workflow, otherwise "manual".
if [[ -n "${GITHUB_REF_NAME:-}" ]]; then
release_label="${GITHUB_REF_NAME}"
else
release_label="manual"
fi
archive="${folder_name}-${release_label}.zip"
echo "Source: $source"
echo "Archive: $archive"
# Set the executable bit on every shell script recursively.
find "$source" -type f -name '*.sh' -exec chmod -v u+x {} +
# Zip from the parent directory so the top-level folder itself
# is included in the archive. ZIP preserves Unix mode bits.
(
cd "$(dirname "$source")"
zip -r -X "$OLDPWD/$archive" "$folder_name"
)
echo "Created: $archive"
- name: Upload archive
uses: actions/upload-artifact@v7
with:
name: release-package
path: "*.zip"
if-no-files-found: error