fix: CI make cwd safe directory for git #18
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-compile | |
on: | |
push: | |
pull_request: | |
jobs: | |
build: | |
name: HDLGameInstaller compilation | |
runs-on: ubuntu-latest | |
container: ps2dev/ps2dev:v1.0 | |
# instead of "ps2dev/ps2dev:latest" you can use different tags, for example for old projects you can use "ps2dev/ps2dev:v1.0" | |
steps: | |
- name: Install dependencies | |
run: | | |
apk add build-base git zip | |
- uses: actions/checkout@v3 | |
- run: | | |
git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
git fetch --prune --unshallow | |
- name: Compile project | |
run: | | |
make | |
# commands for compiling your project | |
- name: Get short SHA and repository name | |
id: slug | |
run: | | |
echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" | |
echo "::set-output name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")" | |
- name: Upload artifacts | |
if: ${{ success() }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ steps.slug.outputs.REPOSITORY_NAME }}-${{ steps.slug.outputs.sha8 }} | |
path: | | |
HDLGameInstaller.elf | |
README.md | |
lang/* | |
build-hdlgmanclient: | |
name: HDLGManClient compilation | |
runs-on: windows-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup msbuild | |
uses: microsoft/setup-msbuild@v1.0.2 | |
- name: Build | |
run: | | |
cd HDLGManClient | |
msbuild /p:Configuration=Release | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: HDLGManClient | |
path: HDLGManClient/Release/HDLGManClient.exe | |
release: | |
needs: [build, build-hdlgmanclient] | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get short SHA and repository name | |
id: slug | |
run: | | |
echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" | |
echo "::set-output name=REPOSITORY_NAME::$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")" | |
- name: Download HDLGameInstaller artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ steps.slug.outputs.REPOSITORY_NAME }}-${{ steps.slug.outputs.sha8 }} | |
path: HDLGameInstaller | |
- name: Prepare HDLGameInstaller archive | |
run: | | |
7z a ${{ steps.slug.outputs.REPOSITORY_NAME }}-${{ steps.slug.outputs.sha8 }}.7z HDLGameInstaller/* | |
- name: Download HDLGManClient artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: HDLGManClient | |
- name: Create pre-release | |
if: github.ref == 'refs/heads/main' | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: true | |
automatic_release_tag: "latest" | |
title: "Development build" | |
files: | | |
${{ steps.slug.outputs.REPOSITORY_NAME }}-${{ steps.slug.outputs.sha8 }}.7z | |
HDLGManClient.exe | |
- 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 | |
automatic_release_tag: "stable" | |
draft: true | |
files: | | |
${{ steps.slug.outputs.REPOSITORY_NAME }}-${{ steps.slug.outputs.sha8 }}.7z | |
HDLGManClient.exe |