-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This allows us to customize it to our needs, such as zipping subfolders into separate archives. The new actions is also simpler as unused features of the original are stripped.
- Loading branch information
Showing
6 changed files
with
81 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,9 +13,8 @@ runs: | |
using: "composite" | ||
steps: | ||
- name: Archive the artifact | ||
uses: thedoctor0/zip-[email protected] | ||
uses: ./.github/actions/zip-folder | ||
with: | ||
type: zip | ||
directory: ${{ inputs.directory }} | ||
path: ${{ inputs.path }} | ||
filename: libgdsion-${{ inputs.platform }}.zip | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Zip up a folder | ||
description: Create a zip archive of a folder or folders. | ||
|
||
inputs: | ||
filename: | ||
description: Output file name for the archive. | ||
default: "" | ||
path: | ||
description: Base path for archive files. | ||
default: "." | ||
directory: | ||
description: Working directory where the command is called. | ||
default: "." | ||
split: | ||
description: Create a separate archive for each directory in the base path. Folder's name is the file name. | ||
default: false | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: | ||
shell: bash | ||
working-directory: ${{ inputs.directory }} | ||
env: | ||
ARCHIVE_OUTPUT_NAME: ${{ inputs.filename }} | ||
ARCHIVE_INCLUDE_PATH: ${{ inputs.path }} | ||
ARCHIVE_SPLIT: ${{ inputs.split && 1 || 0 }} | ||
run: $GITHUB_ACTION_PATH/zip.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#! /bin/bash | ||
|
||
# Adapted from https://github.com/TheDoctor0/zip-release. | ||
|
||
# Create archive or exit if the command fails | ||
set -eu | ||
printf "\n📦 Creating zip archive...\n" | ||
|
||
if [ "$RUNNER_OS" = "Windows" ]; then | ||
if [ "$ARCHIVE_SPLIT" = 1 ]; then | ||
for dir in $ARCHIVE_INCLUDE_PATH/*/ ; do | ||
7z a -tzip "$dir" $ARCHIVE_INCLUDE_PATH/$dir/ || { printf "\n⛔ Unable to create zip archive.\n"; exit 1; } | ||
printf "\n✔ Successfully created %s archive.\n" "$dir" | ||
done | ||
else | ||
7z a -tzip "$ARCHIVE_OUTPUT_NAME" $ARCHIVE_INCLUDE_PATH || { printf "\n⛔ Unable to create zip archive.\n"; exit 1; } | ||
printf "\n✔ Successfully created %s archive.\n" "$ARCHIVE_OUTPUT_NAME" | ||
fi | ||
else | ||
if [ "$ARCHIVE_SPLIT" = 1 ]; then | ||
for dir in $ARCHIVE_INCLUDE_PATH/*/ ; do | ||
zip -r "$dir" $ARCHIVE_INCLUDE_PATH/$dir/ || { printf "\n⛔ Unable to create zip archive.\n"; exit 1; } | ||
printf "\n✔ Successfully created %s archive.\n" "$dir" | ||
done | ||
else | ||
zip -r "$ARCHIVE_OUTPUT_NAME" $ARCHIVE_INCLUDE_PATH || { printf "\n⛔ Unable to create zip archive.\n"; exit 1; } | ||
printf "\n✔ Successfully created %s archive.\n" "$ARCHIVE_OUTPUT_NAME" | ||
fi | ||
fi | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,12 +24,27 @@ jobs: | |
merge-multiple: true | ||
|
||
- name: Archive example project sources | ||
uses: thedoctor0/zip-[email protected] | ||
uses: ./.github/actions/zip-folder | ||
with: | ||
type: zip | ||
directory: example | ||
filename: example-project-source.zip | ||
|
||
- name: Download example project artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
path: example/export | ||
pattern: example-project-* | ||
|
||
- name: Archive example project exports | ||
uses: ./.github/actions/zip-folder | ||
with: | ||
directory: example/export | ||
split: true | ||
|
||
- name: Print folder contents | ||
shell: bash | ||
run: dir -la ./example/export | ||
|
||
- name: Update the rolling release with the example project | ||
shell: bash | ||
env: | ||
|