Skip to content

Commit

Permalink
chore(ci): github build tag release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
maxime1907 committed Aug 22, 2024
1 parent f85f33f commit f3a3bef
Show file tree
Hide file tree
Showing 2 changed files with 139 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
133 changes: 133 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
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
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

0 comments on commit f3a3bef

Please sign in to comment.