|
| 1 | +name: Linux x86_64_deb |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | +# branches: |
| 6 | +# - 'master' |
| 7 | +# - 'main' |
| 8 | + paths-ignore: |
| 9 | + - '.gitignore' |
| 10 | + - '.gitattributes' |
| 11 | + - '**.txt' |
| 12 | + - '**.md' |
| 13 | + - '**.rc' |
| 14 | + pull_request: |
| 15 | + branches: |
| 16 | + - 'master' |
| 17 | + - 'main' |
| 18 | + |
| 19 | +jobs: |
| 20 | + linux-x86_64_deb: |
| 21 | + runs-on: ubuntu-24.04 |
| 22 | + permissions: |
| 23 | + contents: read |
| 24 | + actions: read |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout repository |
| 28 | + uses: actions/checkout@v5 |
| 29 | + with: |
| 30 | + fetch-depth: 0 |
| 31 | + - name: Install prerequisites |
| 32 | + run: | |
| 33 | + lsb_release -d |
| 34 | +
|
| 35 | + sudo add-apt-repository universe && sudo sudo apt-get -qq update |
| 36 | + sudo apt-get install -yq --no-install-recommends \ |
| 37 | + ninja-build gcc-12 g++-12 \ |
| 38 | + dpkg-dev debhelper-compat build-essential \ |
| 39 | + mariadb-client libmariadb-dev |
| 40 | + sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-12 90 --slave /usr/bin/g++ g++ /usr/bin/g++-12 |
| 41 | +
|
| 42 | + - name: Report building tools |
| 43 | + run: | |
| 44 | + echo "GCC:" && gcc -v |
| 45 | + echo "Default Linker:" && ld -v |
| 46 | + echo && echo "CMake:" && cmake --version |
| 47 | + echo && echo "Ninja:" && ninja --version |
| 48 | +
|
| 49 | + - name: Create package |
| 50 | + run: | |
| 51 | + cd packaging |
| 52 | + cat debian/data/changelog | sed -e "s/@version@/$(git rev-list --count HEAD)/" -e "s/@date@/$(date -R)/" > debian/changelog |
| 53 | + dpkg-buildpackage -us -uc -b -d |
| 54 | + mv ../sphereserver_0.X.nightly-$(git rev-list --count HEAD)_amd64.deb ../SphereSvrX-linux-x86_64-nightly.deb |
| 55 | +
|
| 56 | + # Upload artifact linked to the workflow run - only if the run is for a pull request, or for selected branches |
| 57 | + - name: Upload artifact |
| 58 | + if: contains(fromJson('["master", "main"]'), github.ref_name) || github.event_name == 'pull_request' |
| 59 | + uses: actions/upload-artifact@v7 |
| 60 | + env: |
| 61 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 62 | + with: |
| 63 | + name: Build-linux-x86_64_deb |
| 64 | + path: SphereSvrX-linux-x86_64-nightly.deb |
| 65 | + overwrite: true |
| 66 | + |
| 67 | + upload_github_release: |
| 68 | + needs: linux-x86_64_deb |
| 69 | + # Upload artifact linked to GitHub RELEASE we are creating - only if the run is for a pull request, or for selected branches |
| 70 | + if: contains(fromJson('["master", "main"]'), github.ref_name) |
| 71 | + permissions: |
| 72 | + contents: write |
| 73 | + actions: read |
| 74 | + |
| 75 | + runs-on: ubuntu-latest |
| 76 | + steps: |
| 77 | + - name: Download builds |
| 78 | + uses: actions/download-artifact@v8 |
| 79 | + with: |
| 80 | + name: Build-linux-x86_64_deb |
| 81 | + merge-multiple: true |
| 82 | + run-id: ${{ github.run_id }} |
| 83 | + |
| 84 | + - name: Create release |
| 85 | + uses: softprops/action-gh-release@v2 |
| 86 | + env: |
| 87 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 88 | + with: |
| 89 | + name: Nightly |
| 90 | + tag_name: Nightly |
| 91 | + prerelease: true |
| 92 | + files: SphereSvrX-linux-x86_64-nightly.deb |
| 93 | + fail_on_unmatched_files: false |
| 94 | + |
| 95 | + upload_selfhost_release: |
| 96 | + needs: linux-x86_64_deb |
| 97 | + if: contains(fromJson('["master", "main"]'), github.ref_name) && (github.repository == 'SphereServer/Source-X') |
| 98 | + permissions: |
| 99 | + contents: write |
| 100 | + actions: read |
| 101 | + |
| 102 | + runs-on: ubuntu-latest |
| 103 | + steps: |
| 104 | + - name: Download builds |
| 105 | + uses: actions/download-artifact@v8 |
| 106 | + with: |
| 107 | + name: Build-linux-x86_64_deb |
| 108 | + merge-multiple: true |
| 109 | + run-id: ${{ github.run_id }} |
| 110 | + - name: Push release |
| 111 | + run: | |
| 112 | + curl -sST "{SphereSvrX-linux-x86_64-nightly.deb}" -u ${{secrets.UP_USER}}:${{secrets.UP_PASS}} ${{secrets.UP_WHERE}} |
| 113 | + curl -sST "{SphereSvrX-linux-x86_64-nightly.deb}" --ftp-pasv --ssl --ssl-reqd -u '${{secrets.FTP_USER}}:${{secrets.FTP_PASS}}' ${{secrets.FTP_LOC}}/release/prod/ |
0 commit comments