chore(ci): github build tag release workflow #2
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
name: CI | ||
on: | ||
push: | ||
branches: | ||
- main | ||
- master | ||
tags: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- main | ||
- master | ||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: ubuntu-20.04 | ||
Check failure on line 22 in .github/workflows/ci.yml GitHub Actions / CIInvalid workflow file
|
||
metamod-version: 703c36e7b7711ef441932025eebaabf4b7d5e548 | ||
python-version: '3.11' | ||
include: | ||
- os: ubuntu-20.04 | ||
target-archs: x86,x86_64 | ||
sdk: sdk2013 | ||
sdk-version: '4c27c1305c5e042ae1f62f6dc6ba7e96fd06e05d' | ||
compiler_cc: gcc | ||
compiler_cxx: g++ | ||
steps: | ||
- name: Install Linux packages | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt update | ||
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 ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
path: extension | ||
- name: Checkout Metamod | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: alliedmodders/metamod-source | ||
ref: ${{ matrix.metamod-version }} | ||
path: metamod-source | ||
submodules: recursive | ||
- name: Checkout hl2sdks | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: alliedmodders/hl2sdk | ||
ref: ${{ matrix.sdk-version }} | ||
path: hl2sdk-${{ matrix.sdk }} | ||
submodules: recursive | ||
- name: Install AMBuild | ||
run: | | ||
python -m pip install wheel | ||
python -m pip install git+https://github.com/alliedmodders/ambuild | ||
- name: Build | ||
working-directory: extension | ||
shell: bash | ||
env: | ||
BREAKPAD_SYMBOL_SERVER: ${{ secrets.BREAKPAD_SYMBOL_SERVER }} | ||
run: | | ||
ls -all ../ | ||
mkdir build && cd build | ||
python ../configure.py --enable-optimize --symbol-files --targets=${{ matrix.target-archs }} --sdks=${{ matrix.sdks }} | ||
ambuild | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ runner.os }} | ||
path: extension/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 | ||
if [ -d "./Linux/" ]; then | ||
cd ./Linux/ | ||
tar -czf ../${{ github.event.repository.name }}-${version}-linux.tar.gz -T <(\ls -1) | ||
cd - | ||
fi | ||
if [ -d "./macOS/" ]; then | ||
cd ./macOS/ | ||
tar -czf ../${{ github.event.repository.name }}-${version}-mac.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 | ||
- name: Release | ||
uses: svenstaro/upload-release-action@v2 | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: '*.tar.gz' | ||
tag: ${{ github.ref }} | ||
file_glob: true |