Skip to content

trigger-event

trigger-event #69

name: Build and Upload ArchISO
on:
# Triggers the workflow on push or pull request events but only for the "andromeda-reborn" branch e
push:
branches: [ "andromeda-reborn" ]
pull_request:
branches: [ "andromeda-reborn" ] # Allow manual triggering
repository_dispatch:
types: [trigger-event]
jobs:
build-and-upload:
runs-on: ubuntu-22.04
steps:
# Step 1: Checkout repository
- name: Checkout repository
uses: actions/checkout@v3
# Step 2: Print working directory and list contents
- name: Print working directory and list contents
run: |
echo "Current directory:"
pwd
echo "Contents:"
ls -la
# Step 3: Build ArchISO in Docker
- name: Build ArchISO in Docker
run: |
docker run --rm --privileged -v $PWD:/workspace -w /workspace archlinux:latest /bin/bash -c "
pacman -Syu --noconfirm && \
pacman -S --noconfirm archiso sudo && \
cd /workspace && \
sudo pacman-key --init && \
sudo pacman-key --recv-keys AF9C6FE4FEFB98349614C054FEB6CA0157FE8A75 && \
sudo pacman-key --lsign-key AF9C6FE4FEFB98349614C054FEB6CA0157FE8A75 && \
sudo mkarchiso -v -w eisowork -o /workspace eiso && \
mkdir isodir && \
mv *.iso* isodir
cd isodir
md5sum exelentos-andromeda-reborn-x86_64.iso > exelentos-andromeda-reborn-x86_64.iso.md5sum.txt
sha512sum exelentos-andromeda-reborn-x86_64.iso > exelentos-andromeda-reborn-x86_64.iso.sha512sum.txt
"
# Step 4: List built ISO files and prepare
- name: List built ISO files and prepare
run: |
echo "ISO files created:"
ls -la ./isodir
sudo apt update
sudo apt reinstall sshpass
sudo bash -c "apt update ; apt install wget ; wget https://mega.nz/linux/repo/xUbuntu_22.04/amd64/megacmd-xUbuntu_22.04_amd64.deb ; apt install ./*deb"
mkdir ~/.ssh/
ssh-keyscan ${{ secrets.FTP_SERVER }} >> ~/.ssh/known_hosts
# Step 5: Delete existing files on FTP server
- name: Delete existing files on FTP
run: |
echo "Attempting to connect to FTP server and delete files..."
sshpass -p ${{ secrets.FTP_PASSWORD }} sftp ${{ secrets.FTP_USERNAME }}'@'${{ secrets.FTP_SERVER }} <<EOF
cd /home/pfs/project/exelentos/andromeda-reborn
rm *
EOF
# Step 6: Upload ISO files to SourceForge and mega
- name: Upload ISO files to SourceForge and update on Mega
run: |
echo "Uploading files to FTP..."
for file in isodir/*; do
sshpass -p ${{ secrets.FTP_PASSWORD }} sftp ${{ secrets.FTP_USERNAME }}'@'${{ secrets.FTP_SERVER }} <<< $"put $file /home/pfs/project/exelentos/andromeda-reborn/$(basename $file)"
cd isodir
bash ../scripts/mega.sh ${{ secrets.MEGA_EMAIL }} '${{ secrets.FTP_PASSWORD }}' /andromeda-reborn/ $(basename $file)
cd ..
done