diff --git a/.github/workflows/pr-build.yml b/.github/workflows/build.yml similarity index 62% rename from .github/workflows/pr-build.yml rename to .github/workflows/build.yml index efbdca662..3d98abf2d 100644 --- a/.github/workflows/pr-build.yml +++ b/.github/workflows/build.yml @@ -1,10 +1,11 @@ -name: Pull request build +name: Build -on: [pull_request] +on: + - push + - pull_request jobs: windows-64: - runs-on: windows-latest steps: @@ -19,18 +20,29 @@ jobs: run: | mkdir accounts, logs, save, scripts 7z a SphereSvrX-win64-nightly.zip accounts\ logs\ save\ scripts\ .\bin64\Nightly\SphereSvrX64_nightly.exe .\src\sphere.ini .\src\sphereCrypt.ini .\dlls\64\libmysql.dll + + # only upload artifact is pull request + - name: Upload artifact + if: ${{ github.event_name == 'pull_request' }} + uses: actions/upload-artifact@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: Builds + path: SphereSvrX-win64-nightly.zip + + # only create nightly release if the branch is main - name: Create pull request tag and upload files - id: create_release + if: contains(fromJson('["master", "main"]'), github.ref_name) uses: softprops/action-gh-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - name: PR-${{ github.ref_name }} - tag_name: PR-${{ github.ref_name }} + name: Nightly + tag_name: Nightly files: SphereSvrX-win64-nightly.zip windows-32: - runs-on: windows-latest steps: @@ -45,18 +57,29 @@ jobs: run: | mkdir accounts, logs, save, scripts 7z a SphereSvrX-win32-nightly.zip accounts\ logs\ save\ scripts\ .\bin\Nightly\SphereSvrX32_nightly.exe .\src\sphere.ini .\src\sphereCrypt.ini .\dlls\32\libmysql.dll + + # only upload artifact is pull request + - name: Upload artifact + if: ${{ github.event_name == 'pull_request' }} + uses: actions/upload-artifact@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: Builds + path: SphereSvrX-win32-nightly.zip + + # only create nightly release if the branch is main - name: Create pull request tag and upload files - id: create_release + if: contains(fromJson('["master", "main"]'), github.ref_name) uses: softprops/action-gh-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - name: PR-${{ github.ref_name }} - tag_name: PR-${{ github.ref_name }} + name: Nightly + tag_name: Nightly files: SphereSvrX-win32-nightly.zip linux-64: - runs-on: ubuntu-latest steps: @@ -74,18 +97,29 @@ jobs: run: | mkdir accounts logs save scripts tar -czf SphereSvrX-linux64-nightly.tar.gz accounts/ logs/ save/ scripts/ -C bin64/ SphereSvrX64_nightly -C ../src/ sphere.ini sphereCrypt.ini + + # only upload artifact is pull request + - name: Upload artifact + if: ${{ github.event_name == 'pull_request' }} + uses: actions/upload-artifact@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: Builds + path: SphereSvrX-linux64-nightly.tar.gz + + # only create nightly release if the branch is main - name: Create pull request tag and upload files - id: create_release + if: contains(fromJson('["master", "main"]'), github.ref_name) uses: softprops/action-gh-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - name: PR-${{ github.ref_name }} - tag_name: PR-${{ github.ref_name }} + name: Nightly + tag_name: Nightly files: SphereSvrX-linux64-nightly.tar.gz linux-32: - runs-on: ubuntu-latest steps: @@ -104,12 +138,24 @@ jobs: run: | mkdir accounts logs save scripts tar -czf SphereSvrX-linux32-nightly.tar.gz accounts/ logs/ save/ scripts/ -C bin/ SphereSvrX32_nightly -C ../src/ sphere.ini sphereCrypt.ini + + # only upload artifact is pull request + - name: Upload artifact + if: ${{ github.event_name == 'pull_request' }} + uses: actions/upload-artifact@v3 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + name: Builds + path: SphereSvrX-linux32-nightly.tar.gz + + # only create nightly release if the branch is main - name: Create pull request tag and upload files - id: create_release + if: contains(fromJson('["master", "main"]'), github.ref_name) uses: softprops/action-gh-release@v1 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - name: PR-${{ github.ref_name }} - tag_name: PR-${{ github.ref_name }} + name: Nightly + tag_name: Nightly files: SphereSvrX-linux32-nightly.tar.gz \ No newline at end of file diff --git a/.gitignore b/.gitignore index 244e74127..4d5a6d3c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,35 @@ -# Ignore all files, except those already included on git repository -/* -/src/common/version/GitRevision.h -/src/common/libev/config.h +# Ignore folder and files +/bin +/bin64 +/Debug +/Release +/Nightly +/backup/ +/.git/ +/.vscode/ +/x64/ +/x86/ +/obj/ +/build/ +/mul +/accounts/ +/logs/ +/save/ +/web/ + +*.vs +*.pid -!.github \ No newline at end of file +# Ignore files +*.bak +*.log +*.old +*.tmp +*.o +*.obj +*.exe +*.vcxproj.* + +# Ignore git versioning file +/src/common/version/GitRevision.h +/src/common/libev/config.h \ No newline at end of file