|
| 1 | +name: "Swiftly Compiler" |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "**" |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + versioning: |
| 11 | + permissions: |
| 12 | + contents: write |
| 13 | + runs-on: ubuntu-latest |
| 14 | + container: |
| 15 | + image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk |
| 16 | + outputs: |
| 17 | + version: ${{ steps.version.outputs.version }} |
| 18 | + steps: |
| 19 | + - name: Packages |
| 20 | + shell: bash |
| 21 | + run: | |
| 22 | + sudo apt update |
| 23 | + sudo apt install -y curl jq |
| 24 | +
|
| 25 | + - name: Generate version |
| 26 | + |
| 27 | + id: version |
| 28 | + with: |
| 29 | + release_branch: master |
| 30 | + increment: minor |
| 31 | + use_api: true |
| 32 | + |
| 33 | + extensions_build: |
| 34 | + name: Extension Build |
| 35 | + needs: versioning |
| 36 | + runs-on: ${{ matrix.os }} |
| 37 | + container: ${{ matrix.container }} |
| 38 | + strategy: |
| 39 | + fail-fast: false |
| 40 | + matrix: |
| 41 | + os: [ubuntu-latest, windows-latest] |
| 42 | + extension: |
| 43 | + [ |
| 44 | + mysql-extension, |
| 45 | + console-filter, |
| 46 | + addons-extension, |
| 47 | + http-extension, |
| 48 | + ip-extension, |
| 49 | + utils-extension, |
| 50 | + sdktools-extension, |
| 51 | + ] |
| 52 | + include: |
| 53 | + - os: ubuntu-latest |
| 54 | + container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk |
| 55 | + steps: |
| 56 | + - name: Checkout Extension |
| 57 | + uses: actions/checkout@v4 |
| 58 | + with: |
| 59 | + repository: swiftly-solution/${{ matrix.extension }} |
| 60 | + path: ${{ matrix.extension }} |
| 61 | + submodules: recursive |
| 62 | + |
| 63 | + - name: Checkout AMBuild |
| 64 | + uses: actions/checkout@v4 |
| 65 | + with: |
| 66 | + repository: alliedmodders/ambuild |
| 67 | + path: ambuild |
| 68 | + |
| 69 | + - name: Install AMBuild |
| 70 | + run: | |
| 71 | + cd ambuild; python setup.py install; cd .. |
| 72 | +
|
| 73 | + - name: Version |
| 74 | + shell: bash |
| 75 | + run: echo "VERSION=${{needs.versioning.outputs.version}}" >> $GITHUB_ENV |
| 76 | + |
| 77 | + - name: Build - Linux |
| 78 | + if: matrix.os == 'ubuntu-latest' |
| 79 | + working-directory: ${{ matrix.extension }} |
| 80 | + shell: bash |
| 81 | + run: | |
| 82 | + sudo apt update |
| 83 | + sudo apt install -y libreadline-dev libboost-all-dev |
| 84 | + bash ./setup.sh |
| 85 | +
|
| 86 | + - name: Build - Windows |
| 87 | + if: matrix.os == 'windows-latest' |
| 88 | + working-directory: ${{ matrix.extension }} |
| 89 | + run: | |
| 90 | + ./setup.ps1 |
| 91 | +
|
| 92 | + - name: IP EXT - Linux |
| 93 | + if: ${{ matrix.os == 'ubuntu-latest' && matrix.extension == 'ip-extension' }} |
| 94 | + working-directory: ${{ matrix.extension }} |
| 95 | + shell: bash |
| 96 | + run: | |
| 97 | + wget https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb -O build/package/addons/swiftly/data/GeoLite2-City.mmdb |
| 98 | + wget https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb -O build/package/addons/swiftly/data/GeoLite2-ASN.mmdb |
| 99 | +
|
| 100 | + - name: IP EXT - Windows |
| 101 | + if: ${{ matrix.os == 'windows-latest' && matrix.extension == 'ip-extension' }} |
| 102 | + working-directory: ${{ matrix.extension }} |
| 103 | + run: | |
| 104 | + Set-Location build/package/addons/swiftly |
| 105 | +
|
| 106 | + Invoke-WebRequest https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-City.mmdb -OutFile data/GeoLite2-City.mmdb |
| 107 | + Invoke-WebRequest https://github.com/P3TERX/GeoLite.mmdb/raw/download/GeoLite2-ASN.mmdb -OutFile data/GeoLite2-ASN.mmdb |
| 108 | +
|
| 109 | + Set-Location ../../../.. |
| 110 | +
|
| 111 | + - name: Upload Artifacts Linux |
| 112 | + if: matrix.os == 'ubuntu-latest' |
| 113 | + uses: actions/upload-artifact@v4 |
| 114 | + with: |
| 115 | + name: ${{matrix.extension}}.Extension.Linux |
| 116 | + path: ${{ github.workspace }}/${{ matrix.extension }}/build/package |
| 117 | + |
| 118 | + - name: Upload Artifacts Windows |
| 119 | + if: matrix.os == 'windows-latest' |
| 120 | + uses: actions/upload-artifact@v4 |
| 121 | + with: |
| 122 | + name: ${{matrix.extension}}.Extension.Windows |
| 123 | + path: ${{ github.workspace }}/${{ matrix.extension }}/build/package |
| 124 | + |
| 125 | + build: |
| 126 | + name: Build |
| 127 | + needs: versioning |
| 128 | + runs-on: ${{ matrix.os }} |
| 129 | + env: |
| 130 | + MMSOURCE20: ${{ github.workspace }}/swiftly/alliedmodders/metamod |
| 131 | + HL2SDKCS2: ${{ github.workspace }}/swiftly/alliedmodders/hl2sdk |
| 132 | + container: ${{ matrix.container }} |
| 133 | + strategy: |
| 134 | + fail-fast: false |
| 135 | + matrix: |
| 136 | + os: [ubuntu-latest, windows-latest] |
| 137 | + include: |
| 138 | + - os: ubuntu-latest |
| 139 | + container: registry.gitlab.steamos.cloud/steamrt/sniper/sdk |
| 140 | + steps: |
| 141 | + - name: Checkout |
| 142 | + uses: actions/checkout@v4 |
| 143 | + with: |
| 144 | + path: swiftly |
| 145 | + submodules: recursive |
| 146 | + |
| 147 | + - name: Checkout AMBuild |
| 148 | + uses: actions/checkout@v4 |
| 149 | + with: |
| 150 | + repository: alliedmodders/ambuild |
| 151 | + path: ambuild |
| 152 | + |
| 153 | + - name: Install AMBuild |
| 154 | + run: | |
| 155 | + cd ambuild; python setup.py install; cd .. |
| 156 | +
|
| 157 | + - name: Setup Version |
| 158 | + shell: bash |
| 159 | + run: echo "SWIFTLY_VERSION=${{needs.versioning.outputs.version}}" >> $GITHUB_ENV |
| 160 | + |
| 161 | + - name: Build - Linux |
| 162 | + if: matrix.os == 'ubuntu-latest' |
| 163 | + working-directory: swiftly |
| 164 | + shell: bash |
| 165 | + run: | |
| 166 | + sudo apt update |
| 167 | + sudo apt install -y libreadline-dev libboost-all-dev unzip |
| 168 | + bash ./setup.sh |
| 169 | +
|
| 170 | + echo "[Builder] Setting up default plugins" |
| 171 | + cp -r build/package build/package2 |
| 172 | + cd build/package/addons/swiftly |
| 173 | + wget https://github.com/swiftly-solution/admins/releases/latest/download/Swiftly.Plugin.Admins.zip |
| 174 | + unzip Swiftly.Plugin.Admins.zip |
| 175 | + wget https://github.com/swiftly-solution/admins_basecomms/releases/latest/download/Swiftly.Plugin.Admins.BaseComms.zip |
| 176 | + unzip Swiftly.Plugin.Admins.BaseComms.zip |
| 177 | + wget https://github.com/swiftly-solution/admins_basebans/releases/latest/download/Swiftly.Plugin.Admins.BaseBans.zip |
| 178 | + unzip Swiftly.Plugin.Admins.BaseBans.zip |
| 179 | + wget https://github.com/swiftly-solution/admins_commands/releases/latest/download/Swiftly.Plugin.Admins.BaseCommands.zip |
| 180 | + unzip Swiftly.Plugin.Admins.BaseCommands.zip |
| 181 | + wget https://github.com/swiftly-solution/map-chooser/releases/latest/download/Swiftly.Plugin.Map-Chooser.zip |
| 182 | + unzip Swiftly.Plugin.Map-Chooser.zip |
| 183 | + wget https://github.com/swiftly-solution/cookies/releases/latest/download/cookies.zip |
| 184 | + unzip cookies.zip |
| 185 | +
|
| 186 | + rm -rf Swiftly.Plugin.Admins.zip |
| 187 | + rm -rf Swiftly.Plugin.Admins.BaseComms.zip |
| 188 | + rm -rf Swiftly.Plugin.Admins.BaseBans.zip |
| 189 | + rm -rf Swiftly.Plugin.Admins.BaseCommands.zip |
| 190 | + rm -rf Swiftly.Plugin.Map-Chooser.zip |
| 191 | + rm -rf cookies.zip |
| 192 | +
|
| 193 | + cd ../../../.. |
| 194 | + echo "[Builder] Finished setting up default plugins" |
| 195 | +
|
| 196 | + - name: Build - Windows |
| 197 | + if: matrix.os == 'windows-latest' |
| 198 | + working-directory: swiftly |
| 199 | + run: | |
| 200 | + ./setup.ps1 |
| 201 | +
|
| 202 | + Set-Location build/package/addons/swiftly |
| 203 | +
|
| 204 | + Invoke-WebRequest https://github.com/swiftly-solution/admins/releases/latest/download/Swiftly.Plugin.Admins.zip -OutFile Swiftly.Plugin.Admins.zip |
| 205 | + Expand-Archive Swiftly.Plugin.Admins.zip -DestinationPath . |
| 206 | + Invoke-WebRequest https://github.com/swiftly-solution/admins_basecomms/releases/latest/download/Swiftly.Plugin.Admins.BaseComms.zip -OutFile Swiftly.Plugin.Admins.BaseComms.zip |
| 207 | + Expand-Archive Swiftly.Plugin.Admins.BaseComms.zip -DestinationPath . |
| 208 | + Invoke-WebRequest https://github.com/swiftly-solution/admins_basebans/releases/latest/download/Swiftly.Plugin.Admins.BaseBans.zip -OutFile Swiftly.Plugin.Admins.BaseBans.zip |
| 209 | + Expand-Archive Swiftly.Plugin.Admins.BaseBans.zip -DestinationPath . |
| 210 | + Invoke-WebRequest https://github.com/swiftly-solution/admins_commands/releases/latest/download/Swiftly.Plugin.Admins.BaseCommands.zip -OutFile Swiftly.Plugin.Admins.BaseCommands.zip |
| 211 | + Expand-Archive Swiftly.Plugin.Admins.BaseCommands.zip -DestinationPath . |
| 212 | + Invoke-WebRequest https://github.com/swiftly-solution/map-chooser/releases/latest/download/Swiftly.Plugin.Map-Chooser.zip -OutFile Swiftly.Plugin.Map-Chooser.zip |
| 213 | + Expand-Archive Swiftly.Plugin.Map-Chooser.zip -DestinationPath . |
| 214 | + Invoke-WebRequest https://github.com/swiftly-solution/cookies/releases/latest/download/cookies.zip -OutFile cookies.zip |
| 215 | + Expand-Archive cookies.zip -DestinationPath . |
| 216 | +
|
| 217 | + Remove-Item -Force Swiftly.Plugin.Admins.zip |
| 218 | + Remove-Item -Force Swiftly.Plugin.Admins.BaseComms.zip |
| 219 | + Remove-Item -Force Swiftly.Plugin.Admins.BaseBans.zip |
| 220 | + Remove-Item -Force Swiftly.Plugin.Admins.BaseCommands.zip |
| 221 | + Remove-Item -Force Swiftly.Plugin.Map-Chooser.zip |
| 222 | + Remove-Item -Force cookies.zip |
| 223 | +
|
| 224 | + Set-Location ../../../.. |
| 225 | +
|
| 226 | + - name: Upload Artifacts Linux |
| 227 | + if: matrix.os == 'ubuntu-latest' |
| 228 | + uses: actions/upload-artifact@v4 |
| 229 | + with: |
| 230 | + name: Swiftly.Plugin.Linux |
| 231 | + path: ${{ github.workspace }}/swiftly/build/package |
| 232 | + |
| 233 | + - name: Upload Artifacts Windows |
| 234 | + if: matrix.os == 'windows-latest' |
| 235 | + uses: actions/upload-artifact@v4 |
| 236 | + with: |
| 237 | + name: Swiftly.Plugin.Windows |
| 238 | + path: ${{ github.workspace }}/swiftly/build/package |
| 239 | + |
| 240 | + release: |
| 241 | + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} |
| 242 | + permissions: |
| 243 | + contents: write |
| 244 | + needs: ["versioning", "build", "extensions_build"] |
| 245 | + runs-on: ubuntu-latest |
| 246 | + container: |
| 247 | + image: registry.gitlab.steamos.cloud/steamrt/sniper/sdk |
| 248 | + steps: |
| 249 | + - uses: actions/download-artifact@v4 |
| 250 | + id: download-artifacts |
| 251 | + with: |
| 252 | + path: build |
| 253 | + |
| 254 | + - name: Prepare ZIP Files |
| 255 | + run: | |
| 256 | + sudo apt install p7zip-full -y; |
| 257 | +
|
| 258 | + find build -type d -name "*Extension.Linux" -exec cp -r {}/addons build/Swiftly.Plugin.Linux \; |
| 259 | + find build -type d -name "*Extension.Windows" -exec cp -r {}/addons build/Swiftly.Plugin.Windows \; |
| 260 | +
|
| 261 | + (cd build/Swiftly.Plugin.Linux; 7z a -tzip ../../../Swiftly.Plugin.Linux.zip *) |
| 262 | + (cd build/Swiftly.Plugin.Windows; 7z a -tzip ../../../Swiftly.Plugin.Windows.zip *) |
| 263 | + echo "PATH_ARTIFACTS=$(cd ..; pwd)" >> $GITHUB_ENV |
| 264 | +
|
| 265 | + - name: Release |
| 266 | + id: release |
| 267 | + uses: softprops/action-gh-release@v2 |
| 268 | + with: |
| 269 | + tag_name: v${{ needs.versioning.outputs.version }} |
| 270 | + make_latest: "true" |
| 271 | + files: | |
| 272 | + ${{env.PATH_ARTIFACTS}}/Swiftly.Plugin.Linux.zip |
| 273 | + ${{env.PATH_ARTIFACTS}}/Swiftly.Plugin.Windows.zip |
0 commit comments