Skip to content

Commit

Permalink
Feature/update GitHub workflow (#922)
Browse files Browse the repository at this point in the history
* update gitignore and update build workflow for upload artifact

* minor fix for upload build on main and master

* change name of artifacts
  • Loading branch information
raydienull authored Oct 19, 2022
1 parent 2df08a3 commit 1779501
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 27 deletions.
90 changes: 68 additions & 22 deletions .github/workflows/pr-build.yml → .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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
39 changes: 34 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
# Ignore files
*.bak
*.log
*.old
*.tmp
*.o
*.obj
*.exe
*.vcxproj.*

# Ignore git versioning file
/src/common/version/GitRevision.h
/src/common/libev/config.h

0 comments on commit 1779501

Please sign in to comment.