diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..74e13a3 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,66 @@ +name: Build and Deploy ISO +on: + release: + types: [published] + +jobs: + build_iso: + runs-on: docker + container: + image: archlinux/archlinux:base-devel + env: + Desktop: "template" + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build ISO + run: | + ./build.sh + echo "Renaming the output ISO file" + mv out/*.iso out/ParchLinux-${{ env.Desktop }}-latest.iso + echo "Generating MD5 checksum" + md5sum out/ParchLinux-${{ env.Desktop }}-latest.iso > out/md5sum.txt + echo "Build completed. Files generated:" + ls -lh out/ + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: iso-artifacts + path: | + out/ParchLinux-${{ env.Desktop }}-latest.iso + out/md5sum.txt + + deploy_iso: + runs-on: docker + needs: [build_iso] + container: + image: archlinux/archlinux:base-devel + env: + Desktop: "template" + SSH_HOST: ${{ secrets.SSHHOST }} + steps: + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: iso-artifacts + path: out/ + + - name: Setup dependencies + run: pacman -Syu --noconfirm sshpass rsync + + - name: Determine remote directory + run: | + if [[ "${{ github.event.release.tag_name }}" == *"beta"* ]]; then + echo "REMOTE_DIR=/srv/http/beta/${{ env.Desktop }}/" >> $GITHUB_ENV + else + echo "REMOTE_DIR=/srv/http/${{ env.Desktop }}/" >> $GITHUB_ENV + fi + + - name: Deploy files + env: + SSHPASS: ${{ secrets.SSHPASS }} + run: | + sshpass -e ssh -o StrictHostKeyChecking=no parch@${{ env.SSH_HOST }} "rm -rf ${{ env.REMOTE_DIR }} && mkdir -p ${{ env.REMOTE_DIR }}" + sshpass -e rsync -avz out/ParchLinux-${{ env.Desktop }}-latest.iso out/md5sum.txt parch@${{ env.SSH_HOST }}:${{ env.REMOTE_DIR }} diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml deleted file mode 100644 index fe8a97e..0000000 --- a/.github/workflows/build.yaml +++ /dev/null @@ -1,76 +0,0 @@ -# This workflow will build an Arch Linux ISO file with the commit on it -name: build parchiso per release -on: - release: - types: - - created - -env: - api_key: ${{ secrets.GITHUB_TOKEN }} - name: ${{ github.event.repository.name }} - release_name: ${{ github.ref_name }} - GH_TOKEN: ${{ github.token }} - HOST: mirror.parchlinux.com -jobs: - build-beta: - if: github.event.release.prerelease == true - permissions: - contents: write - runs-on: ubuntu-latest - container: - image: archlinux:latest - options: --privileged - steps: - - uses: actions/checkout@v3 - - name: Install Packages via Pacman - run: pacman -Sy; pacman --noconfirm -S git archiso python python-pygithub github-cli reflector p7zip openssh sshpass rsync wget - - name: Build image - run: mkarchiso -v iso/ - - name: remove last iso - run: sshpass -p "${{ secrets.SSH_PASS }}" ssh -o StrictHostKeyChecking=no root@$HOST rm -rf /srv/http/test/ - - name: remove last iso - run: sshpass -p "${{ secrets.SSH_PASS }}" ssh -o StrictHostKeyChecking=no root@$HOST mkdir /srv/http/test/ - - name: rename iso - run: mv "$(ls out/*.iso)" out/Parchlinux-test-latest.iso - - name: upload iso to host - run: sshpass -p "${{ secrets.SSH_PASS }}" rsync -r "$(ls out/*.iso)" root@mirror.parchlinux.com:/srv/http/test/ - - name: Upload iso to the release - run: | - cd ./out - mkdir iso_parts - # split -d -b 2000M "$(ls *.iso)" iso_parts/"$(ls *.iso)"_part - #zip -s 2000m iso_parts/"$(ls *.iso)".zip "$(ls *.iso)" - 7z -v1000m a iso_parts/"$(ls *.iso)".zip "$(ls *.iso)" - md5sum iso_parts/* > iso_parts/md5sums.txt - gh release upload ${{ github.event.release.tag_name }} ./iso_parts/* -R ${{ github.repository }} - build: - if: github.event.release.prerelease == false - permissions: - contents: write - runs-on: ubuntu-latest - container: - image: archlinux:latest - options: --privileged - steps: - - uses: actions/checkout@v3 - - name: Install Packages via Pacman - run: pacman -Sy; pacman --noconfirm -S git archiso python python-pygithub github-cli reflector p7zip openssh sshpass rsync wget - - name: Build image - run: mkarchiso -v iso/ - - name: remove last iso - run: sshpass -p "${{ secrets.SSH_PASS }}" ssh -o StrictHostKeyChecking=no root@$HOST rm -rf /srv/http/test/ - - name: remove last iso - run: sshpass -p "${{ secrets.SSH_PASS }}" ssh -o StrictHostKeyChecking=no root@$HOST mkdir /srv/http/test/ - - name: rename iso - run: mv "$(ls out/*.iso)" out/Parchlinux-test-latest.iso - - name: upload iso to host - run: sshpass -p "${{ secrets.SSH_PASS }}" rsync -r "$(ls out/*.iso)" root@mirror.parchlinux.com:/srv/http/test/ - - name: Upload iso to the release - run: | - cd ./out - mkdir iso_parts - # split -d -b 2000M "$(ls *.iso)" iso_parts/"$(ls *.iso)"_part - #zip -s 2000m iso_parts/"$(ls *.iso)".zip "$(ls *.iso)" - 7z -v1000m a iso_parts/"$(ls *.iso)".zip "$(ls *.iso)" - md5sum iso_parts/* > iso_parts/md5sums.txt - gh release upload ${{ github.event.release.tag_name }} ./iso_parts/* -R ${{ github.repository }}