-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from Tiaansu/master
Add GitHub workflows
- Loading branch information
Showing
2 changed files
with
174 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Build | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
env: | ||
RELEASE_BIN: pawn_json | ||
RELEASE_ADDS: json.inc | ||
RUST: stable-i686 | ||
|
||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust (rustup) | ||
run: rustup update ${{ env.RUST }} --no-self-update && rustup default ${{ env.RUST }} | ||
|
||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Rename binary | ||
run: cp .\target\release\${{ env.RELEASE_BIN }}.dll .\target\release\json.dll | ||
|
||
- name: Create artifacts directory | ||
run: | | ||
mkdir artifacts/plugins | ||
mkdir artifacts/pawno/include | ||
- name: Copy files to artifacts directory | ||
run: | | ||
cp .\target\release\json.dll .\artifacts\plugins\json.dll | ||
cp .\${{ env.RELEASE_ADDS }} .\artifacts\pawno\include\${{ env.RELEASE_ADDS }} | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: json-windows | ||
path: artifacts/ | ||
|
||
build-linux: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install gcc-multilib | ||
run: sudo apt update && sudo apt install gcc-multilib -y | ||
|
||
- name: Install Rust (rustup) | ||
run: rustup update ${{ env.RUST }} --no-self-update && rustup default ${{ env.RUST }} | ||
|
||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Rename binary | ||
run: cp target/release/lib${{ env.RELEASE_BIN }}.so target/release/json.so | ||
|
||
- name: Create artifacts directory | ||
run: | | ||
mkdir -p artifacts/plugins | ||
mkdir -p artifacts/pawno/include | ||
- name: Copy files to artifacts directory | ||
run: | | ||
cp target/release/json.so artifacts/plugins/json.so | ||
cp ${{ env.RELEASE_ADDS }} artifacts/pawno/include/${{ env.RELEASE_ADDS }} | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: json-linux | ||
path: artifacts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Release | ||
|
||
on: | ||
release: | ||
types: | ||
- created | ||
|
||
env: | ||
RELEASE_BIN: pawn_json | ||
RELEASE_ADDS: json.inc | ||
RUST: stable-i686 | ||
|
||
jobs: | ||
release-windows: | ||
runs-on: windows-2019 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install Rust (rustup) | ||
run: rustup update ${{ env.RUST }} --no-self-update && rustup default ${{ env.RUST }} | ||
|
||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Rename binary | ||
run: cp .\target\release\${{ env.RELEASE_BIN }}.dll .\target\release\json.dll | ||
|
||
- name: Create artifact directory | ||
run: | | ||
mkdir artifacts/plugins | ||
mkdir artifacts/pawno/include | ||
- name: Copy files to artifacts directory | ||
run: | | ||
cp .\target\release\json.dll .\artifacts\plugins\json.dll | ||
cp .\${{ env.RELEASE_ADDS }} .\artifacts\pawno\include\${{ env.RELEASE_ADDS }} | ||
- name: Create an archive | ||
run: | | ||
cd .\artifacts | ||
7z a json-windows.zip | ||
- name: Upload to release | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: artifacts\json-windows.zip | ||
asset_name: json-windows.zip | ||
asset_content_type: application/gzip | ||
|
||
release-linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Install gcc-multilib | ||
run: sudo apt update && sudo apt install gcc-multilib -y | ||
|
||
- name: Install Rust (rustup) | ||
run: rustup update ${{ env.RUST }} --no-self-update && rustup default ${{ env.RUST }} | ||
|
||
- name: Build | ||
run: cargo build --release | ||
|
||
- name: Rename binary | ||
run: cp target/release/lib${{ env.RELEASE_BIN }}.so target/release/json.so | ||
|
||
- name: Create artifacts directory | ||
run: | | ||
mkdir -p artifacts/plugins | ||
mkdir -p artifacts/pawno/include | ||
- name: Copy files to artifacts directory | ||
run: | | ||
cp target/release/json.so artifacts/plugins/json.so | ||
cp ${{ env.RELEASE_ADDS }} artifacts/pawno/include/${{ env.RELEASE_ADDS }} | ||
- name: Create an archive | ||
run: | | ||
cd artifacts | ||
7z a -ttar -so -an . | 7z a -si ./json-linux-x86.tar.gz | ||
- name: Upload to release | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: artifacts/json-linux-x86.tar.gz | ||
asset_name: json-linux-x86.tar.gz | ||
asset_content_type: application/gzip |