Fix Github Actions workflow. #27
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 | |
permissions: | |
contents: write | |
on: | |
push: | |
branches: | |
- master | |
env: | |
LIB_DIR: SkoutLib | |
LIB_NAME: SkoutLib.csproj | |
TOOLS_DIR: SkoutTools | |
TOOLS_NAME: SkoutTools.csproj | |
NIGHTLY_TAG: Nightly | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
name: Build SkoutLib and SkoutTools | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
env: | |
ARTIFACTS_PATH: ${{ github.workspace }}/artifacts | |
PUBLISH_NIGHTLY: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'Doom2fan' }} | |
steps: | |
- uses: actions/checkout@master | |
with: | |
fetch-depth: 0 | |
- name: Get version, build, and pack | |
run: | | |
echo Cleaning up... | |
rm -rf $ARTIFACTS_PATH || true | |
mkdir $ARTIFACTS_PATH | |
dotnet clean $LIB_DIR/$LIB_NAME | |
dotnet clean $TOOLS_DIR/$TOOLS_NAME | |
echo Building and packing library... | |
dotnet pack --include-symbols -p:SymbolPackageFormat=snupkg -c Release -o $ARTIFACTS_PATH $LIB_DIR/$LIB_NAME | |
echo Building and packing tools... | |
cd $TOOLS_DIR | |
declare -a osTargets=("win-x64" "linux-x64") | |
for i in "${osTargets[@]}" | |
do | |
dotnet publish --runtime $i --no-self-contained -p:PublishProfile=FolderProfile -p:PublishDir=./SkoutTools_$i -c Release $TOOLS_NAME | |
7z a -tzip $ARTIFACTS_PATH/SkoutTools_$i.zip SkoutTools_$i/ | |
done | |
- uses: actions/upload-artifact@master | |
with: | |
name: nuget-package | |
path: | | |
${{ env.ARTIFACTS_PATH }}/*.nupkg | |
${{ env.ARTIFACTS_PATH }}/*.snupkg | |
- uses: actions/upload-artifact@master | |
with: | |
name: SkoutTools_win-x64 | |
path: ${{ env.ARTIFACTS_PATH }}/SkoutTools_win-x64.zip | |
- uses: actions/upload-artifact@master | |
with: | |
name: SkoutTools_linux-x64 | |
path: ${{ env.ARTIFACTS_PATH }}/SkoutTools_linux-x64.zip | |
- name: Delete old release assets | |
if: ${{ env.PUBLISH_NIGHTLY }}} | |
uses: mknejp/delete-release-assets@v1 | |
with: | |
token: ${{ github.token }} | |
tag: ${{ env.NIGHTLY_TAG }} | |
assets: '*' | |
fail-if-no-assets: false | |
fail-if-no-release: false | |
- name: Upload nightly asset | |
if: ${{ env.PUBLISH_NIGHTLY }}} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.ARTIFACTS_PATH }}/* | |
tag: ${{ env.NIGHTLY_TAG }} | |
file_glob: true | |
prerelease: true | |
- name: Tag Repo | |
if: ${{ env.PUBLISH_NIGHTLY }}} | |
uses: richardsimko/update-tag@v1.0.7 | |
with: | |
tag_name: ${{ env.NIGHTLY_TAG }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |