Skip to content

Fix file server to handle globs directly #1552

Fix file server to handle globs directly

Fix file server to handle globs directly #1552

Workflow file for this run

name: Build Core
on:
push:
branches:
- v3
tags:
- v3.*
paths-ignore:
- '.github/workflows/tester.yml'
- '.github/workflows/run-template-tester.yml'
- '.github/workflows/formatter.yml'
pull_request:
branches:
- v3
paths-ignore:
- 'client/frontend/src/lang/**.json'
env:
SWAG_VERSION: "1.16.2"
GO_VERSION: "1.21"
NODE_VERSION: "20"
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
concurrency:
group: ${{ github.event_name}}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-shared:
name: Build Shared Objects
runs-on: ubuntu-20.04
if: "startsWith(github.ref, 'refs/tags/v') || !contains(github.event.head_commit.message, '[skip]')"
timeout-minutes: 10
steps:
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^${{ env.GO_VERSION }}
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Restore yarn cache
uses: actions/cache@v3
with:
path: ~/.yarn
key: ${{ runner.os }}-nodemodules-${{ env.NODE_VERSION }}-${{ hashFiles('client/yarn.lock') }}
restore-keys: |
${{ runner.os }}-nodemodules-${{ env.NODE_VERSION }}-
- name: Restore yarn cache
uses: actions/cache@v3
with:
path: |
client/node_modules
client/api/node_modules
client/frontend/node_modules
key: ${{ runner.os }}-node-${{ hashFiles('client/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-
- name: Restore Go Modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}-
- name: Restore Go BIN
uses: actions/cache@v3
with:
path: |
~/go/bin
key: ${{ runner.os }}-swag-${{ env.SWAG_VERSION }}
restore-keys: |
${{ runner.os }}-swag-
- name: Download Go Binaries
run: |
wget https://github.com/swaggo/swag/releases/download/v${{ env.SWAG_VERSION }}/swag_${{ env.SWAG_VERSION }}_Linux_x86_64.tar.gz
mkdir -p ~/go/bin
tar -zxf swag*.tar.gz -C ~/go/bin
rm -rf swag*.tar.gz
- name: Generate Swagger Docs
run: |
go mod download
~/go/bin/swag init --md . -o web/swagger -g web/loader.go
- name: yarn install, build
run: |
npm install -g yarn
yarn install
env VITE_CHECK_ENV="true" yarn build
env:
CI: true
working-directory: client
- name: Upload Swagger docs
uses: actions/upload-artifact@v3
with:
name: pufferpanel_swagger
path: |
web/swagger/swagger.json
web/swagger/swagger.yaml
if-no-files-found: error
- name: Generate folders and remove excess files
run: |
rm -rf .git .github web/swagger/swagger.json web/swagger/swagger.yaml build-artifacts/client/frontend/dist/*.map
zip -r pufferpanel_build_artifact.zip *
- name: Generate job artifact
uses: actions/upload-artifact@v3
with:
name: pufferpanel_build_artifact
path: pufferpanel_build_artifact.zip
if-no-files-found: error
retention-days: 1
build-windows-amd64-binaries:
name: Build Binaries - Windows AMD64
runs-on: ubuntu-20.04
needs: [ 'build-shared' ]
timeout-minutes: 10
steps:
- name: Get the version
run: echo "VERSION=0.0.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Get the version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^${{ env.GO_VERSION }}
- uses: actions/download-artifact@v2
with:
name: pufferpanel_build_artifact
- name: Unzip archive
run: |
unzip pufferpanel_build_artifact.zip
- name: Download APT packages
run: |
sudo apt-get update
sudo apt-get install --download-only -y gcc-mingw-w64
- name: APT Install
run: |
sudo apt-get install -y gcc-mingw-w64
- name: Prep
env:
secret_set: ${{ secrets.CURSEFORGE_CODE != '' }}
if: ${{ env.secret_set }}
run: |
echo '${{ secrets.CURSEFORGE_CODE }}' > config/curseforge.go
- name: Build Windows
run: |
go build -o build-artifacts/pufferpanel.exe -ldflags "-X 'github.com/pufferpanel/pufferpanel/v3.Hash=${{ github.sha }}' -X 'github.com/pufferpanel/pufferpanel/v3.Version=${{ env.VERSION }}'" -v github.com/pufferpanel/pufferpanel/v3/cmd
env:
GOOS: windows
GOARCH: amd64
CC: x86_64-w64-mingw32-gcc
CXX: x86_64-w64-mingw32-g++
CGO_ENABLED: 1
- name: Publish Artifacts
uses: actions/upload-artifact@v1
with:
name: pufferpanel_${{ env.VERSION }}_windows_amd64
path: build-artifacts/
build-windows-installer:
name: Build Windows Installer
runs-on: windows-latest
needs: [ 'build-windows-amd64-binaries' ]
env:
DOTNET_CHANNEL: '8.0'
WIX_VERSION: '4.0.4'
timeout-minutes: 10
steps:
- name: Get the version
run: |
$VERSION="0.0.${{ github.run_number }}"
if ("${{ github.ref }}".startsWith("refs/tags/v")) {
$VERSION="${{ github.ref }}".substring('refs/tags/v'.length)
}
echo VERSION=$VERSION | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
# - name: Restore DOTNET BIN
# uses: actions/cache@v3
# id: dotnet-cache
# with:
# path: |
# ~\dotnet
# key: ${{ runner.os }}-dotnet-${{ env.DOTNET_CHANNEL }}
# restore-keys: |
# ${{ runner.os }}-dotnet-
#
# - name: Restore Wix cache
# uses: actions/cache@v3
# id: wix-cache
# with:
# path: |
# ~\.wix
# ~\.dotnet
# key: ${{ runner.os }}-wix-${{ env.DOTNET_CHANNEL }}
# restore-keys: |
# ${{ runner.os }}-wix-
- name: Prepare .NET
#if: steps.dotnet-cache.outputs.cache-hit != 'true'
run: |
Invoke-WebRequest "https://dot.net/v1/dotnet-install.ps1" -OutFile dotnet-install.ps1
.\dotnet-install.ps1 -Channel ${{ env.DOTNET_CHANNEL }} -InstallDir dotnet
Remove-Item dotnet-install.ps1
- name: Set Path
run: |
Add-Content $env:GITHUB_PATH "$pwd\dotnet"
Add-Content $env:GITHUB_PATH "$pwd\.dotnet\tools"
Add-Content $env:GITHUB_ENV "DOTNET_ROOT=$pwd\dotnet"
- name: Install WIX
#if: steps.wix-cache.outputs.cache-hit != 'true'
run: |
dotnet tool install --tool-path .dotnet\tools wix --version ${{ env.WIX_VERSION }}
wix extension add WixToolset.Firewall.wixext/${{ env.WIX_VERSION }}
wix extension add WixToolset.UI.wixext/${{ env.WIX_VERSION }}
wix extension add WixToolset.Util.wixext/${{ env.WIX_VERSION }}
- uses: actions/download-artifact@v3
with:
name: pufferpanel_${{ env.VERSION }}_windows_amd64
path: binaries
- uses: actions/download-artifact@v3
with:
name: pufferpanel_build_artifact
path: artifacts
- name: Unzip archive
run: |
cd artifacts
unzip pufferpanel_build_artifact.zip
- name: Generate MSI
run: |
Copy-Item -Recurse -Path binaries\* -Destination .
Copy-Item -Path artifacts\client\frontend\public\favicon.ico -Destination .
Copy-Item -Path artifacts\LICENSE.rtf -Destination .
Copy-Item -Path artifacts\installer.wxs -Destination .
set password $((New-Guid).ToString())
wix build -o pufferpanel.msi -arch x64 -d ProductVersion="${{ env.VERSION }}" -d Password="$password" -ext WixToolset.Firewall.wixext -ext WixToolset.UI.wixext -ext WixToolset.Util.wixext installer.wxs
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: pufferpanel_${{ env.VERSION }}_installer.msi
path: pufferpanel.msi
build-linux-amd64-binaries:
name: Build Binaries - Linux AMD64
runs-on: ubuntu-20.04
needs: [ 'build-shared' ]
timeout-minutes: 10
steps:
- name: Get the version
run: echo "VERSION=0.0.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Get the version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^${{ env.GO_VERSION }}
- name: Download APT packages
run: |
sudo apt-get update
sudo apt-get install --download-only -y rpm
- name: APT Install
run: |
sudo apt-get install -y rpm
- uses: actions/download-artifact@v2
with:
name: pufferpanel_build_artifact
- name: Unzip archive
run: |
unzip pufferpanel_build_artifact.zip
- name: Restore Go Modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}
- name: Prep
env:
secret_set: ${{ secrets.CURSEFORGE_CODE != '' }}
if: ${{ env.secret_set }}
run: |
echo '${{ secrets.CURSEFORGE_CODE }}' > config/curseforge.go
- name: Build Linux
run: |
go build -o build-artifacts/pufferpanel -ldflags "-X 'github.com/pufferpanel/pufferpanel/v3.Hash=${{ github.sha }}' -X 'github.com/pufferpanel/pufferpanel/v3.Version=${{ env.VERSION }}'" -v github.com/pufferpanel/pufferpanel/v3/cmd
go test -v ./...
env:
GOOS: linux
GOARCH: amd64
- name: Set up build folder
run: |
mkdir -p DEBBUILD/usr/sbin DEBBUILD/var/www/pufferpanel
mkdir -p DEBBUILD/var/log/pufferpanel RPMBUILD/var/log/pufferpanel
mkdir -p DEBBUILD/etc/pufferpanel DEBBUILD/lib/systemd/system/
mkdir -p DEBBUILD/var/lib/pufferpanel/binaries RPMBUILD/var/lib/pufferpanel
cp config.linux.json DEBBUILD/etc/pufferpanel/config.json
cp build-artifacts/pufferpanel DEBBUILD/usr/sbin/pufferpanel
cp systemd/servicefiles/pufferpanel.service DEBBUILD/lib/systemd/system/pufferpanel.service
- name: Build Package DEB AMD64
id: debamd64
uses: pufferpanel/build-deb@master
with:
data-folder: DEBBUILD
package: pufferpanel
version: ${{ env.VERSION }}
license: Apache 2.0
architecture: amd64
maintainer: PufferPanel <dev@pufferpanel.com>
homepage: https://pufferpanel.com
description: Game management server panel
before-install: systemd/scripts/preinstall.sh
after-install: systemd/scripts/postinstall.sh
before-upgrade: systemd/scripts/preupgrade.sh
after-upgrade: systemd/scripts/postupgrade.sh
before-remove: systemd/scripts/preremove.sh
after-remove: systemd/scripts/postremove.sh
after-purge: systemd/scripts/purge.sh
user: pufferpanel
group: pufferpanel
suggested-packages: |
lib32gcc1
- name: Build Package RPM AMD64
id: rpmamd64
uses: pufferpanel/build-rpm@master
with:
package: pufferpanel
version: ${{ env.VERSION }}
license: Apache 2.0
architecture: x86_64
maintainer: PufferPanel <dev@pufferpanel.com>
website: https://pufferpanel.com
summary: Game management server panel
before-install: systemd/scripts/preinstall.sh
after-install: systemd/scripts/postinstall.sh
before-upgrade: systemd/scripts/preupgrade.sh
after-upgrade: systemd/scripts/postupgrade.sh
before-remove: systemd/scripts/preremove.sh
after-remove: systemd/scripts/postremove.sh
after-purge: systemd/scripts/purge.sh
user: pufferpanel
group: pufferpanel
files: |
build-artifacts/pufferpanel:/usr/sbin/pufferpanel
config.linux.json:/etc/pufferpanel/config.json
systemd/servicefiles/pufferpanel.service:/lib/systemd/system/pufferpanel.service
RPMBUILD/var/lib/pufferpanel:/var/lib/pufferpanel
RPMBUILD/var/log/pufferpanel:/var/log/pufferpanel
config: |
/etc/pufferpanel/config.json:noreplace
suggested-packages: |
glibc.i686
libstdc++.i686
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: pufferpanel_${{ env.VERSION }}_linux_amd64
path: build-artifacts/
- name: Publish Artifacts
uses: actions/upload-artifact@v1
with:
name: pufferpanel_${{ env.VERSION }}_amd64.deb
path: pufferpanel_${{ env.VERSION }}_amd64.deb
- name: Publish Artifacts
uses: actions/upload-artifact@v1
with:
name: pufferpanel-${{ env.VERSION }}-1.x86_64.rpm
path: ${{ steps.rpmamd64.outputs.file }}
build-linux-arm64-binaries:
name: Build Binaries - Linux ARM64
runs-on: ubuntu-20.04
needs: [ 'build-shared' ]
timeout-minutes: 10
steps:
- name: Get the version
run: echo "VERSION=0.0.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Get the version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^${{ env.GO_VERSION }}
- uses: actions/download-artifact@v3
with:
name: pufferpanel_build_artifact
- name: Unzip archive
run: |
unzip pufferpanel_build_artifact.zip
- name: Download APT packages
run: |
sudo apt-get update
sudo apt-get install --download-only -y gcc-aarch64-linux-gnu
- name: APT Install
run: |
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Restore Go Modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ env.GO_VERSION }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ env.GO_VERSION }}
- name: Prep
env:
secret_set: ${{ secrets.CURSEFORGE_CODE != '' }}
if: ${{ env.secret_set }}
run: |
echo '${{ secrets.CURSEFORGE_CODE }}' > config/curseforge.go
- name: Build ARM64
run: |
go build -o build-artifacts/pufferpanel -ldflags "-X 'github.com/pufferpanel/pufferpanel/v3.Hash=${{ github.sha }}' -X 'github.com/pufferpanel/pufferpanel/v3.Version=${{ env.VERSION }}'" -v github.com/pufferpanel/pufferpanel/v3/cmd
env:
GOOS: linux
GOARCH: arm64
CC: aarch64-linux-gnu-gcc
CGO_ENABLED: 1
- name: Set up build folder
run: |
mkdir -p DEBBUILD/usr/sbin DEBBUILD/var/www/pufferpanel
mkdir -p DEBBUILD/var/log/pufferpanel DEBBUILD/etc/pufferpanel DEBBUILD/lib/systemd/system/
cp config.linux.json DEBBUILD/etc/pufferpanel/config.json
cp build-artifacts/pufferpanel DEBBUILD/usr/sbin/pufferpanel
cp systemd/servicefiles/pufferpanel.service DEBBUILD/lib/systemd/system/pufferpanel.service
- name: Build Package DEB ARM64
id: debarm64
uses: pufferpanel/build-deb@master
with:
data-folder: DEBBUILD
package: pufferpanel
version: ${{ env.VERSION }}
license: Apache 2.0
architecture: arm64
maintainer: PufferPanel <dev@pufferpanel.com>
homepage: https://pufferpanel.com
description: Game management server panel
before-install: systemd/scripts/preinstall.sh
after-install: systemd/scripts/postinstall.sh
before-upgrade: systemd/scripts/preupgrade.sh
after-upgrade: systemd/scripts/postupgrade.sh
before-remove: systemd/scripts/preremove.sh
after-remove: systemd/scripts/postremove.sh
after-purge: systemd/scripts/purge.sh
user: pufferpanel
group: pufferpanel
suggested-packages: |
lib32gcc1
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: pufferpanel_${{ env.VERSION }}_linux_arm64
path: build-artifacts
- name: Publish Artifacts
uses: actions/upload-artifact@v3
with:
name: pufferpanel_${{ env.VERSION }}_arm64.deb
path: pufferpanel_${{ env.VERSION }}_arm64.deb
cleanup:
runs-on: ubuntu-20.04
name: "Cleanup"
#if: ${{ always() }}
needs: [ build-shared, build-docker-image-base, build-windows-amd64-binaries, build-windows-installer, build-linux-amd64-binaries, build-linux-arm64-binaries, release ]
continue-on-error: true
steps:
- name: Delete artifacts
uses: geekyeggo/delete-artifact@v2
with:
name: pufferpanel_build_artifact
build-docker-image-base:
name: "Build Docker image"
if: "startsWith(github.ref, 'refs/tags/v') || !contains(github.event.head_commit.message, '[skip]')"
runs-on: ubuntu-20.04
permissions:
contents: read
packages: write
environment: ${{ startsWith(github.ref, 'refs/tags/') && 'Release' || 'Development' }}
timeout-minutes: 10
env:
REGISTRY: ${{ vars.REGISTRY != 'docker.com' && vars.REGISTRY || '' }}
REGISTRY_USERNAME: ${{ vars.REGISTRY == 'ghcr.io' && github.actor || secrets.REGISTRY_USERNAME }}
REGISTRY_PASSWORD: ${{ vars.REGISTRY == 'ghcr.io' && secrets.GITHUB_TOKEN || secrets.REGISTRY_PASSWORD }}
steps:
- name: Get the version
run: echo "VERSION=0.0.${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV
- name: Get the version
if: startsWith(github.ref, 'refs/tags/v')
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV
- name: Ensure mask
id: values
run: |
echo "::add-mask::$REGISTRY_USERNAME"
echo "::add-mask::$REGISTRY_PASSWORD"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Login to DockerHub
if: env.REGISTRY_USERNAME != '' && env.REGISTRY != ''
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Login to DockerHub
if: env.REGISTRY_USERNAME != '' && env.REGISTRY == ''
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ env.REGISTRY_USERNAME }}
password: ${{ env.REGISTRY_PASSWORD }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
name=${{ vars.REGISTRY != 'docker.com' && format('{0}/', env.REGISTRY) || '' }}${{ env.IMAGE_NAME }},enable=${{ vars.REGISTRY != 'docker.com' }}
name=${{ env.IMAGE_NAME }},enable=${{ vars.REGISTRY == 'docker.com' }}
flavor: |
latest=false
tags: |
type=ref,prefix=branch-,event=branch
type=semver,pattern={{version}}
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
file: Dockerfile
push: ${{ github.event_name != 'pull_request' && env.REGISTRY_USERNAME != '' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
sha=${{ github.sha }}
version=${{ env.VERSION }}
curseforgeKey=${{ secrets.CURSEFORGE_KEY }}
platforms: linux/amd64,linux/arm64
release:
name: "Deployment"
runs-on: ubuntu-latest
needs:
- build-docker-image-base
- build-windows-amd64-binaries
- build-windows-installer
- build-linux-amd64-binaries
- build-linux-arm64-binaries
permissions:
contents: write
environment: ${{ startsWith(github.ref, 'refs/tags/v') && 'Release' || 'Development' }}
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
- name: Install gems
run: |
gem install --no-doc package_cloud
- uses: actions/download-artifact@v3
with:
merge-multiple: true
- name: Push to repo
env:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
run: |
package_cloud push ${{ vars.PACKAGECLOUD_REPO }}/any/any */pufferpanel_*_amd64.deb
package_cloud push ${{ vars.PACKAGECLOUD_REPO }}/any/any */pufferpanel_*_arm64.deb
package_cloud push ${{ vars.PACKAGECLOUD_REPO }}/rpm_any/rpm_any */pufferpanel-*.x86_64.rpm
- name: Create Release
id: create_release
if: "startsWith(github.ref, 'refs/tags/v')"
uses: softprops/action-gh-release@v1
with:
draft: true
prerelease: true
files: |
pufferpanel_*_linux_amd64
pufferpanel_*_linux_arm64
pufferpanel_*_windows_amd64
*/*.rpm
*/*.deb
*/*.msi