Merge pull request #2 from khulnasoft-bot/main #10
This file contains hidden or 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
| name: CTX OS CI/CD | |
| on: | |
| push: | |
| branches: [main, testing] | |
| pull_request: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install ShellCheck | |
| run: sudo apt-get install -y shellcheck | |
| - name: Run ShellCheck | |
| run: | | |
| find bin/ -type f -name '*.sh' -o -name 'ctx-*' -o -name 'ftpsync*' -o -name 'runmirrors' -o -name 'rsync-*' -o -name 'mirror-*' -o -name 'archive_*' -o -name 'common' -o -name 'include-*' | xargs shellcheck -x | |
| build-and-deploy: | |
| needs: lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v4 | |
| - name: Install Build Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y debhelper devscripts reprepro gpg gpg-agent wget | |
| - name: Install dpkg-dev | |
| run: | | |
| sudo apt-get install -y dpkg-dev | |
| - name: Import GPG Key | |
| if: env.GPG_PRIVATE_KEY != '' | |
| run: | | |
| echo "${{ secrets.GPG_PRIVATE_KEY }}" | base64 -d | gpg --import --batch --yes | |
| echo "allow-preset-passphrase" >> ~/.gnupg/gpg-agent.conf 2>/dev/null || true | |
| - name: Build Debian Package | |
| run: | | |
| chmod +x bin/*.sh debian/rules debian/postinst debian/postrm debian/preinst debian/prerm | |
| debuild -us -uc | |
| mkdir -p build_assets | |
| cp ../ctxos-core*.deb build_assets/ 2>/dev/null || true | |
| - name: Update Reprepro Repository | |
| run: | | |
| TARGET_BRANCH="testing" | |
| if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then | |
| TARGET_BRANCH="bookworm" | |
| fi | |
| echo "Building for: $TARGET_BRANCH" | |
| if [ -d "debian" ]; then | |
| echo "Debian directory found" | |
| fi | |
| - name: Create Release Artifacts | |
| run: | | |
| mkdir -p release | |
| cp ../ctxos-core*.deb release/ 2>/dev/null || echo "No .deb found" | |
| ls -la release/ | |
| - name: Upload Release Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ctxos-packages | |
| path: release/ | |
| retention-days: 30 |