Skip to content

Commit

Permalink
feat(ci): release job (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime1907 authored Oct 11, 2023
1 parent 2c3d68e commit 9bd1610
Showing 1 changed file with 68 additions and 27 deletions.
95 changes: 68 additions & 27 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ name: build

on:
push:
branches:
- main
- master
paths-ignore:
- LICENSE
- README.md
- LICENSE
- README.md
tags:
- '*'
pull_request:
branches:
- main
- master
paths-ignore:
- LICENSE
- README.md
workflow_dispatch:
- LICENSE
- README.md
schedule:
- cron: '30 03 01 */3 *' # Artifacts expire every 3 months

Expand All @@ -23,53 +30,55 @@ jobs:
os:
- ubuntu-20.04
- windows-latest

sm_version:
- "1.8"
- "1.9"
- "1.10"
- "1.11"
- "latest"

include:
# Use MM:Source 1.10 as base version
- meta_version: "1.10"
meta_branch: "1.10-dev"

- sm_version: latest
sm_branch: master
meta_version: latest
meta_branch: master

- sm_version: "1.8"
sm_branch: "1.8-dev"

- sm_version: "1.9"
sm_branch: "1.9-dev"

- sm_version: "1.10"
sm_branch: "1.10-dev"

- sm_version: "1.11"
sm_branch: "1.11-dev"
meta_version: "1.11"
meta_branch: "1.11-dev"

- os: ubuntu-20.04
os_short: linux

- os: windows-latest
os_short: win

steps:
- name: Preparing to dump debug symbols
uses: actions/checkout@v3
with:
repository: mozilla/dump_syms
path: dump_syms

- uses: actions-rs/toolchain@v1
with:
toolchain: stable

- uses: actions-rs/cargo@v1
with:
command: install
Expand All @@ -79,7 +88,7 @@ jobs:
shell: bash
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Install (Linux)
if: runner.os == 'Linux'
run: |
Expand All @@ -92,7 +101,7 @@ jobs:
- name: Add msbuild to PATH (Windows)
if: runner.os == 'Windows'
uses: microsoft/[email protected]

- name: Install (Windows)
if: runner.os == 'Windows'
shell: cmd
Expand All @@ -106,30 +115,30 @@ jobs:
for /f "delims== tokens=1,2" %%a in ('set') do (
echo>>"%GITHUB_ENV%" %%a=%%b
)
- name: Getting SourceMod ${{ matrix.sm_version }}
uses: actions/checkout@v3
with:
repository: alliedmodders/sourcemod
ref: ${{ matrix.sm_branch }}
path: sourcemod-${{ matrix.sm_version }}
submodules: recursive

- name: Getting MM:Source ${{ matrix.meta_version }}
uses: actions/checkout@v3
with:
repository: alliedmodders/metamod-source
ref: ${{ matrix.meta_branch }}
path: metamod-${{ matrix.meta_version }}

- name: Getting Python
uses: actions/setup-python@v4

- name: Getting ambuild
run: |
python -m pip install wheel
pip install git+https://github.com/alliedmodders/ambuild
- name: Getting SDKs
shell: bash
run: |
Expand All @@ -139,20 +148,20 @@ jobs:
do
git clone hl2sdk-proxy-repo -b $sdk hl2sdk-$sdk
done
- name: Getting own repository
uses: actions/checkout@v3
with:
path: sourcetvmanager

- name: Compiling SourceTV Manager files
working-directory: sourcetvmanager
run: |
mkdir build
cd build
python ../configure.py --enable-optimize --sdks=present --sm-path="${{ github.workspace }}/sourcemod-${{ matrix.sm_version }}" --mms-path="${{ github.workspace }}/metamod-${{ matrix.meta_version }}"
ambuild
- name: Uploading debug symbols
working-directory: sourcetvmanager/build
shell: bash
Expand All @@ -165,9 +174,41 @@ jobs:
fi
curl --data-binary @$f.syms https://crash.limetech.org/symbols/submit
done
- name: Uploading package
uses: actions/upload-artifact@v3
with:
name: sourcetvmanager-sm${{ matrix.sm_version }}-${{ matrix.os_short }}-${{ env.GITHUB_SHA_SHORT }}
name: sourcetvmanager-sm${{ matrix.sm_version }}-${{ matrix.os_short }}
path: sourcetvmanager/build/package

release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest

steps:
- name: Download artifacts
uses: actions/download-artifact@v3

- name: Package
run: |
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`
ls -Rall
for folder in sourcetvmanager*
do
echo "Processing folder: $folder"
cd $folder
tar -czf ../${folder}-${version}.tar.gz -T <(\ls -1)
cd -
done
- name: Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: '*.tar.gz'
tag: ${{ github.ref }}
file_glob: true

0 comments on commit 9bd1610

Please sign in to comment.