DarkflameServer/.github/workflows/publishing.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

101 lines
2.7 KiB
YAML
Raw Normal View History

2023-05-09 20:32:50 +00:00
name: CI
on:
push:
paths:
2023-05-09 20:33:13 +00:00
- versions.txt
2023-05-09 20:32:50 +00:00
jobs:
build-and-test:
name: Build & Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
2023-05-09 21:59:01 +00:00
os: [ ubuntu-20.04 ]
2023-05-09 20:32:50 +00:00
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Add msbuild to PATH (Windows only)
if: ${{ matrix.os == 'windows-2022' }}
uses: microsoft/setup-msbuild@v1.1
with:
vs-version: '[17,18)'
msbuild-architecture: x64
- name: Install libssl (Mac Only)
if: ${{ matrix.os == 'macos-11' }}
run: brew install openssl@3
- name: cmake
uses: lukka/run-cmake@v10
with:
configurePreset: "ci-${{matrix.os}}"
buildPreset: "ci-${{matrix.os}}"
testPreset: "ci-${{matrix.os}}"
- name: artifacts
uses: actions/upload-artifact@v3
with:
name: build-${{matrix.os}}
path: |
2023-05-09 20:55:09 +00:00
build/*Server*
build/*.ini
build/*.so
build/*.dll
build/vanity/
build/navmeshes/
build/migrations/
build/*.dcf
2023-05-09 21:18:21 +00:00
!build/*.pdb
!build/d*/
2023-05-09 21:33:15 +00:00
draft-release:
needs: build-and-test
runs-on: ubuntu-latest
steps:
2023-05-09 22:45:33 +00:00
- name: Checkout repository
uses: actions/checkout@v2
- name: Take a gander at versions.txt to get updated information
run: |
IFS=" - " read -ra PARTS <<< "$(head -n 1 versions.txt)"
echo "VERSION=${PARTS[0]}" >> $GITHUB_ENV
echo "DESCRIPTION=${PARTS[1]}" >> $GITHUB_ENV
2023-05-09 21:33:15 +00:00
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
2023-05-09 22:45:33 +00:00
tag_name: v${{ env.VERSION }}
release_name: Release v${{ env.VERSION }}
body: Draft release for version v${{ env.VERSION }} \n ${{ env.DESCRIPTION }}
2023-05-09 21:33:15 +00:00
draft: true
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
2023-05-09 21:59:01 +00:00
with:
path: artifacts
2023-05-09 21:33:15 +00:00
- name: Upload Release Assets
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
2023-05-09 22:28:38 +00:00
cd artifacts
for folder in */; do
zip -r "${folder%/}.zip" "$folder"
done
ls
2023-05-09 22:15:26 +00:00
for file in *.zip; do
2023-05-09 21:33:15 +00:00
echo "Uploading $file"
curl --progress-bar \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ env.GITHUB_TOKEN }}" \
--upload-file "$file" \
-H "Content-Type: $(file --mime-type -b $file)" \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=$(basename $file)"
done