Skip to content

Commit

Permalink
asdasd
Browse files Browse the repository at this point in the history
  • Loading branch information
Bioblaze committed Dec 3, 2024
1 parent e45a878 commit f8bf526
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/actions/checksum-txt-generator/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Generate SHA-256 Checksums
description: Computes SHA-256 checksums for all files in a specified directory and outputs them to checksum.txt.

inputs:
directory:
description: The directory containing the files to process.
required: true

outputs:
checksum_file:
description: The path to the generated checksum.txt file.
value: ${{ steps.checksum.outputs.checksum_file }}

runs:
using: "composite"
steps:
- name: Generate Checksums
id: checksum
shell: bash
run: |
CHECKSUM_DIR="${{ inputs.directory }}"
CHECKSUM_FILE="${CHECKSUM_DIR}/checksum.txt"
# Ensure the directory exists
if [ ! -d "$CHECKSUM_DIR" ]; then
echo "Error: Directory $CHECKSUM_DIR does not exist." >> $GITHUB_STEP_SUMMARY
exit 1
fi
# Create or clear the checksum file
> "$CHECKSUM_FILE"
echo "Generating SHA-256 checksums for files in $CHECKSUM_DIR" >> $GITHUB_STEP_SUMMARY
# Loop through each file and compute checksum
for FILE in "$CHECKSUM_DIR"/*; do
if [ -f "$FILE" ]; then
FILENAME=$(basename "$FILE")
CHECKSUM=$(sha256sum "$FILE" | awk '{print $1}')
echo "$FILENAME $CHECKSUM" >> "$CHECKSUM_FILE"
fi
done
echo "Checksum file created: $CHECKSUM_FILE" >> $GITHUB_STEP_SUMMARY
echo "Contents of checksum.txt:" >> $GITHUB_STEP_SUMMARY
cat "$CHECKSUM_FILE" >> $GITHUB_STEP_SUMMARY
# Output the path to the checksum file
echo "checksum_file=$CHECKSUM_FILE" >> $GITHUB_OUTPUT
2 changes: 2 additions & 0 deletions .github/workflows/deploy_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ jobs:
with:
build_sha: ${{ inputs.build_sha }}
runner_id: ${{ inputs.runner_id }}
new_version: ${{ inputs.new_version }}


editor-deploy:
name: 📊 Template Deploy
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/template_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ on:
description: "Runner ID of the Parent Runner"
required: true
type: string
new_version:
description: "New Version that'll be Deployed"
required: true
type: string
# Global Settings
env:
# Used for the cache key. Add version suffix to force clean build.
Expand Down Expand Up @@ -272,6 +276,58 @@ jobs:
else
echo "Directory ${GITHUB_WORKSPACE}/templates/mono does not exist." >> $GITHUB_STEP_SUMMARY
fi
- name: Generate Checksums for Templates
uses: ./.github/actions/checksum-txt-generator
with:
directory: ${{ github.workspace }}/templates

- name: Generate Checksums for Mono Templates
uses: ./.github/actions/checksum-txt-generator
with:
directory: ${{ github.workspace }}/templates/mono

- name: Write New Version to File
shell: bash
run: |
# Define the target folder and file
TARGET_DIR="${GITHUB_WORKSPACE}/templates"
TARGET_FILE="${TARGET_DIR}/version.txt"
# Ensure the target directory exists
if [ ! -d "$TARGET_DIR" ]; then
echo "Creating directory: $TARGET_DIR"
mkdir -p "$TARGET_DIR"
fi
# Write the new version to the file
echo "${{ inputs.new_version }}" > "$TARGET_FILE"
# Log the action
echo "New version written to $TARGET_FILE:" >> $GITHUB_STEP_SUMMARY
cat "$TARGET_FILE" >> $GITHUB_STEP_SUMMARY
- name: Write New Mono Version to File
shell: bash
run: |
# Define the target folder and file
TARGET_DIR="${GITHUB_WORKSPACE}/templates/mono"
TARGET_FILE="${TARGET_DIR}/version.txt"
# Ensure the target directory exists
if [ ! -d "$TARGET_DIR" ]; then
echo "Creating directory: $TARGET_DIR"
mkdir -p "$TARGET_DIR"
fi
# Write the new version to the file
echo "${{ inputs.new_version }}.mono" > "$TARGET_FILE"
# Log the action
echo "New version written to $TARGET_FILE:" >> $GITHUB_STEP_SUMMARY
cat "$TARGET_FILE" >> $GITHUB_STEP_SUMMARY
# - name: Uncompress File
# id: new-folder
# uses: ./.github/actions/uncompress-tar-gz
Expand Down

0 comments on commit f8bf526

Please sign in to comment.