Skip to content

Commit

Permalink
Merge branch 'main' into jansson-upt
Browse files Browse the repository at this point in the history
  • Loading branch information
Rushaway authored Oct 11, 2023
2 parents b841352 + f7fe742 commit 8e9b240
Showing 1 changed file with 57 additions and 33 deletions.
90 changes: 57 additions & 33 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
name: CI

on: [push, pull_request, workflow_dispatch]
name: Build and release

on:
push:
branches:
- main
- master
tags:
- 'v*.*.*'
pull_request:
branches:
- main
- master

jobs:
build:
Expand All @@ -9,32 +19,55 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]
os: [ubuntu-20.04, windows-2019, macos-11]
sourcemod-version: [1.11-dev]
python-version: ['3.10']
include:
- os: ubuntu-20.04
target-archs: x86,x86_64
platform: linux
compiler_cc: clang
compiler_cxx: clang++

- os: windows-2019
target-archs: x86,x86_64
platform: windows
compiler_cc: clang
compiler_cxx: clang++

- os: macos-11
target-archs: x86_64
platform: macos
compiler_cc: clang
compiler_cxx: clang++

steps:
- name: Install Linux packages
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install -yq --no-install-recommends g++-multilib
sudo apt install -yq --no-install-recommends g++-multilib ${{ matrix.compiler_cc }}
- name: Select compiler
if: startsWith(runner.os, 'Linux')
run: |
echo "CC=${{ matrix.compiler_cc }}" >> $GITHUB_ENV
echo "CXX=${{ matrix.compiler_cxx }}" >> $GITHUB_ENV
${{ matrix.compiler_cc }} --version
${{ matrix.compiler_cxx }} --version
- name: Set up Python
uses: actions/setup-python@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
path: extension

- name: Checkout SourceMod
uses: actions/checkout@v2
- name: Checkout SourceMod ${{ matrix.sourcemod-version }}
uses: actions/checkout@v4
with:
repository: alliedmodders/sourcemod
ref: ${{ matrix.sourcemod-version }}
Expand All @@ -46,12 +79,6 @@ jobs:
python -m pip install wheel
pip install git+https://github.com/alliedmodders/ambuild
- name: Checkout AMBuild
uses: actions/checkout@v2
with:
repository: alliedmodders/ambuild
path: ambuild

- name: Build
working-directory: extension
shell: bash
Expand All @@ -64,12 +91,11 @@ jobs:
ambuild
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}
name: ${{ github.event.repository.name }}-${{ matrix.platform }}
path: extension/build/package


release:
name: Release
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -78,26 +104,24 @@ jobs:

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

- name: Package
run: |
version=`echo $GITHUB_REF | sed "s/refs\/tags\///"`
if [ -d "./Linux/" ]; then
cd ./Linux/
tar -czf ../${{ github.event.repository.name }}-${version}-linux.tar.gz -T <(\ls -1)
cd -
fi
if [ -d "./Windows/" ]; then
cd ./Windows/
tar -czf ../${{ github.event.repository.name }}-${version}-windows.tar.gz -T <(\ls -1)
cd -
fi
for folder in ./*; do
if [ -d "$folder" ]; then
echo "Processing folder: $folder"
cd $folder
tar -czf ../$folder.tar.gz -T <(\ls -1)
cd ..
sha256sum $folder.tar.gz > $folder.tar.gz.sha256
fi
done
- name: Release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: '*.tar.gz'
file: '*.tar.gz*'
tag: ${{ github.ref }}
file_glob: true
file_glob: true

0 comments on commit 8e9b240

Please sign in to comment.