Skip to content

Set up build workflow to publish releases #1

Set up build workflow to publish releases

Set up build workflow to publish releases #1

Workflow file for this run

name: build
on:
push:
paths-ignore: [LICENSE, README.md]
pull_request:
paths-ignore: [LICENSE, README.md]
jobs:
create_release:
name: Create release
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Get short SHA
id: vars
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: r${{ github.run_number }}-${{ github.ref_name }}
release_name: Build ${{ env.GITHUB_SHA_SHORT }}
draft: false
prerelease: true
build:
name: ${{matrix.os}}-${{matrix.game}}-sm${{matrix.sm}}
needs: create_release
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-20.04]
game: [tf2]
sm: ['1.11']
include:
- os: ubuntu-20.04
os_short: linux
package_ext: .tar.gz
branch: 1.11-dev
steps:
- name: setup env
shell: bash
run: |
echo "GITHUB_SHA_SHORT=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: setup linux
if: runner.os == 'Linux'
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y clang g++-multilib
echo "CC=clang" >> $GITHUB_ENV
echo "CXX=clang++" >> $GITHUB_ENV
- name: clone hl2sdk
uses: actions/checkout@main
with:
repository: alliedmodders/hl2sdk
ref: ${{matrix.game}}
path: hl2sdk-${{matrix.game}}
- name: clone sourcemod
uses: actions/checkout@main
with:
repository: alliedmodders/sourcemod
ref: ${{matrix.branch}}
path: sourcemod-${{matrix.sm}}
submodules: recursive
- name: clone metamod
uses: actions/checkout@main
with:
repository: alliedmodders/metamod-source
ref: ${{matrix.branch}}
path: metamod-${{matrix.sm}}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Checkout ambuild
run: |
python -m pip install wheel
pip install git+https://github.com/alliedmodders/ambuild
- name: clone ext
uses: actions/checkout@main
with:
path: extenson
- name: build ext
working-directory: extenson
run: |
mkdir build
cd build
python ../configure.py --enable-optimize --sm-path="${{github.workspace}}/sourcemod-${{matrix.sm}}" --mms-path="${{github.workspace}}/metamod-${{matrix.sm}}" --sdks=${{matrix.game}}
ambuild
- name: Build Package (Linux)
if: runner.os == 'Linux'
working-directory: extenson/build
shell: bash
run: |
pushd package
tar -czf "../package.${{ matrix.package_ext }}" --owner=0 --group=0 addons
popd
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.create_release.outputs.upload_url }}
asset_path: extenson/build/package.${{ matrix.package_ext }}
asset_name: package.${{ matrix.package_ext }}
asset_content_type: application/octet-stream