Skip to content

Update release-pipeline.yml #15

Update release-pipeline.yml

Update release-pipeline.yml #15

name: Check and Copy Updated Files
on:
push:
branches:
- main
jobs:
check-and-copy:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.RENDER_KEY }}
- name: Set up SSH for Git
run: |
# Set up SSH key authentication for git
mkdir -p ~/.ssh
echo "${{ secrets.RENDER_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
# Add GitHub to known hosts to avoid authenticity prompts
ssh-keyscan github.com >> ~/.ssh/known_hosts
# Start SSH agent and add the deploy key
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa
- name: Parse File List from release/README.qmd
id: parse
run: |
# Extract the table section and parse the file paths
raw_file_list=$(awk '/\| name/ {f=1; next} /\|----/ {next} f && /\|/ {print $2}' software/release/README.qmd | tr -d ' ')
# Add the software/ prefix to each file path
echo "$raw_file_list" | sed 's/^/software\//' > file_list.txt
# Debugging output
echo "Files to monitor:"
cat file_list.txt
- name: Copy Files to Release Folder
run: |
mkdir -p software/release # Ensure the release folder exists
while read file; do
# Skip the config.py file
if [[ "$(basename $file)" == "config.py" ]]; then
echo "Skipping config.py"
continue
fi
# Copy the file, overwriting if it already exists
cp "$file" software/release/ # Overwrite files directly to the root of the release folder
done < file_list.txt
- name: List Files in Release Folder
run: |
echo "Files copied to the release folder:"
find software/release -type f
- name: Commit and Push Changes
run: |
# Configure Git
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Add, commit and push changes
git add software/release/
git commit -m "Copy updated files to the release folder"
git push origin main