Some improvements #17
Workflow file for this run
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: | |
pull_request: | |
workflow_dispatch: {} | |
jobs: | |
build: | |
runs-on: ${{ matrix.os[0] }} | |
strategy: | |
matrix: | |
os: [[macos-latest, bash], [ubuntu-latest, bash], [windows-latest, msys2]] | |
fail-fast: false | |
defaults: | |
run: | |
shell: ${{ matrix.os[1] }} {0} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install MSYS2 packages | |
if: matrix.os[0] == 'windows-latest' | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: MINGW32 | |
install: | | |
base-devel mingw-w64-i686-gcc | |
update: true | |
- name: Compile native versions | |
run: | | |
make -j $(getconf _NPROCESSORS_ONLN) clean | |
make -j $(getconf _NPROCESSORS_ONLN) all | |
- name: Get short SHA | |
id: slug | |
run: | | |
echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT | |
- name: Create tar archive (keep executable bit) | |
run: tar -zcvf ps2client-${{ steps.slug.outputs.sha8 }}-${{matrix.os[0]}}.tar.gz bin | |
- name: Upload artefacts | |
if: matrix.os[0] != 'windows-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ps2client-${{ steps.slug.outputs.sha8 }}-${{matrix.os[0]}} | |
path: | | |
*tar.gz | |
build-win: | |
runs-on: ubuntu-latest | |
container: dockcross/windows-static-x86:latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Compile windows version with cross-compilator | |
run: | | |
make -j $(getconf _NPROCESSORS_ONLN) --trace clean | |
make -j $(getconf _NPROCESSORS_ONLN) --trace all | |
- name: Get short SHA | |
id: slug | |
run: | | |
echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT | |
- name: Create tar archive | |
run: tar -zcvf ps2client-${{ steps.slug.outputs.sha8 }}-windows-latest.tar.gz bin | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ps2client-${{ steps.slug.outputs.sha8 }}-windows-latest | |
path: | | |
*tar.gz | |
release: | |
needs: [build, build-win] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get short SHA | |
id: slug | |
run: | | |
echo "sha8=$(echo ${GITHUB_SHA} | cut -c1-8)" >> $GITHUB_OUTPUT | |
- name: Download Mac artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ps2client-${{ steps.slug.outputs.sha8 }}-macos-latest | |
- name: Download Ubuntu artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ps2client-${{ steps.slug.outputs.sha8 }}-ubuntu-latest | |
- name: Download Windows artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ps2client-${{ steps.slug.outputs.sha8 }}-windows-latest | |
- name: Create pre-release | |
if: github.ref == 'refs/heads/master' | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: true | |
automatic_release_tag: "latest" | |
title: "Development build" | |
files: | | |
*tar.gz | |
- name: Create Tagged Release Draft | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
draft: true | |
files: | | |
*tar.gz |