-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
27d7070
commit 40a9421
Showing
1 changed file
with
38 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,48 @@ | ||
# This is a basic workflow to help you get started with Actions | ||
|
||
name: Release Generator | ||
|
||
# Controls when the action will run. | ||
name: Create Release | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the $default-branch branch | ||
push: | ||
branches: [ $default-branch ] | ||
pull_request: | ||
branches: [ $default-branch ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
branches: | ||
- main # Adjust this to your main branch name | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
# The type of runner that the job will run on | ||
runs-on: ubuntu-latest | ||
|
||
# Steps represent a sequence of tasks that will be executed as part of the job | ||
steps: | ||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | ||
- uses: actions/checkout@v2 | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Git | ||
run: | | ||
git config --global user.name 'JadianRadiator' | ||
git config --global user.email '[email protected]' | ||
- name: Create and zip releases | ||
run: | | ||
# Function to zip the contents of a folder | ||
function zip_folder_contents { | ||
local folder="$1" | ||
local zip_filename="$folder.zip" | ||
pushd "$folder" >/dev/null || return | ||
zip -r "../$zip_filename" . | ||
popd >/dev/null || return | ||
} | ||
# Runs a single command using the runners shell | ||
- name: Run a one-line script | ||
run: echo Hello, world! | ||
# Check if there are any folders to zip | ||
if [ -d */ ]; then | ||
# Loop through each directory in the repository | ||
for folder in */; do | ||
folder="${folder%/}" # Remove trailing slash | ||
zip_folder_contents "$folder" | ||
done | ||
# Runs a set of commands using the runners shell | ||
- name: Run a multi-line script | ||
run: | | ||
echo Add other actions to build, | ||
echo test, and deploy your project. | ||
echo "Zip archives created successfully." | ||
else | ||
echo "No folders found to zip." | ||
fi | ||
- name: Commit and push changes | ||
run: | | ||
git add *.zip | ||
git commit -m "Create release zip files" | ||
git push |