Skip to content

Commit

Permalink
Fixed Github action
Browse files Browse the repository at this point in the history
*Now Github actions are working
*Each commit will produce a pre-release with all binaries
*tags will produce Release Draft which should be reviewed by human before posting
  • Loading branch information
AKuHAK authored Jan 29, 2021
1 parent 68e555f commit e1af223
Showing 1 changed file with 79 additions and 32 deletions.
111 changes: 79 additions & 32 deletions .github/workflows/compilation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,101 @@ name: CI
on:
push:
pull_request:
repository_dispatch:
types: [run_build]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]

steps:
steps:
- uses: actions/checkout@v2
- name: Runs all the stages in the shell

- name: Compile native versions
run: |
export PS2DEV=$PWD/ps2dev
export PS2SDK=$PS2DEV/ps2sdk
export GSKIT=$PS2DEV/gsKit
export PATH=$PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
make clean all install
make --debug
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"

- name: Compress bin folder
run: |
tar -zcvf bin.tar.gz ps2dev/bin

- name: Create tar archive (keep executable bit)
run: tar -zcvf ps2client-${{ steps.slug.outputs.sha8 }}-${{matrix.os}}.tar.gz bin

- uses: actions/upload-artifact@v2
with:
name: ps2client-${{ steps.slug.outputs.sha8 }}-${{matrix.os}}
path: ps2dev/bin/
path: |
*tar.gz
build-win:
runs-on: ubuntu-latest
container: dockcross/windows-static-x86:latest

- name: Extract tag name
if: startsWith(github.ref, 'refs/tags/')
id: tag
uses: actions/[email protected]
steps:
- uses: actions/checkout@v2

- name: Compile windows version with cross-compilator
run: |
make -f Makefile.mingw32 --trace
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"

- name: Create tar archive
run: tar -zcvf ps2client-${{ steps.slug.outputs.sha8 }}-windows-latest.tar.gz bin

- uses: actions/upload-artifact@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
return context.payload.ref.replace(/\/refs\/tags\//, '');
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@v2

- name: Release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v1
- name: Get short SHA
id: slug
run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)"

- name: Download Mac artifact
uses: actions/download-artifact@v2
with:
name: ps2client-${{ steps.slug.outputs.sha8 }}-macos-latest

- name: Download Ubuntu artifact
uses: actions/download-artifact@v2
with:
name: ps2client-${{ steps.slug.outputs.sha8 }}-ubuntu-latest

- name: Download Windows artifact
uses: actions/download-artifact@v2
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:
files: ps2dev.tar.gz
tag_name: ${{ steps.tag.outputs.result }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
draft: true
files: |
*tar.gz

0 comments on commit e1af223

Please sign in to comment.