Update CD workflow #25
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: CD | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
types: | |
- synchronize | |
- opened | |
jobs: | |
ubuntu_x86_64: | |
name: Ubuntu x64 | |
runs-on: ubuntu-20.04 | |
env: | |
ARCH: x86_64 | |
OUTPUT: Editor-x86_64-continuous.AppImage | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Cache ccache results | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ runner.os }}-ccache-${{ github.repository }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-ccache-${{ github.repository }}-${{ github.ref }}- | |
${{ runner.os }}-ccache-${{ github.repository }}- | |
${{ runner.os }}-ccache- | |
- name: Get Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
- name: Install development dependencies | |
uses: ./.github/dependencies | |
- uses: lukka/get-cmake@latest | |
- uses: lukka/run-vcpkg@v11 | |
- uses: lukka/run-cmake@v10 | |
with: | |
configurePreset: 'linux-ci' | |
buildPreset: 'linux-ci' | |
- name: Package Application | |
run: ./utils/build_appimage.sh build/ci | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.OUTPUT }} | |
path: ${{ env.OUTPUT }} | |
windows_win64: | |
name: Windows x64 | |
runs-on: windows-latest | |
env: | |
OUTPUT: Editor-win64-continuous.zip | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Cache ccache results | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ runner.os }}-ccache-${{ github.repository }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-ccache-${{ github.repository }}-${{ github.ref }}- | |
${{ runner.os }}-ccache-${{ github.repository }}- | |
${{ runner.os }}-ccache | |
- name: Install development dependencies | |
uses: ./.github/dependencies | |
- uses: lukka/get-cmake@latest | |
- uses: lukka/run-vcpkg@v11 | |
- uses: lukka/run-cmake@v10 | |
with: | |
configurePreset: 'mingw-ci' | |
buildPreset: 'mingw-ci' | |
- name: Package Application | |
run: | | |
cmake --install build/ci | |
7z a ${{ env.OUTPUT }} "./install/ci/*" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.OUTPUT }} | |
path: ${{ env.OUTPUT }} | |
macos_x86_64: | |
name: MacOS x64 | |
runs-on: macos-12 | |
env: | |
OUTPUT: Editor-macOS-continuous.zip | |
CCACHE_DIR: ${{ github.workspace }}/ccache | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Cache ccache results | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: ${{ runner.os }}-ccache-${{ github.repository }}-${{ github.ref }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-ccache-${{ github.repository }}-${{ github.ref }}- | |
${{ runner.os }}-ccache-${{ github.repository }}- | |
${{ runner.os }}-ccache | |
- name: Install development dependencies | |
uses: ./.github/dependencies | |
- uses: lukka/get-cmake@latest | |
- uses: lukka/run-vcpkg@v11 | |
- uses: lukka/run-cmake@v10 | |
with: | |
configurePreset: 'macos-ci' | |
buildPreset: 'macos-ci' | |
- name: Package Application | |
run: | | |
cmake --install build/ci | |
7z a ${{ env.OUTPUT }} "./install/ci/*" | |
- name: Upload artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ env.OUTPUT }} | |
path: ${{ env.OUTPUT }} | |
upload_artifacts_to_release: | |
if: github.event_name == 'push' | |
name: Uploads artifacts to Release | |
runs-on: ubuntu-latest | |
needs: | |
- ubuntu_x86_64 | |
- windows_win64 | |
- macos_x86_64 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OUTPUT_UBUNTU: Editor-x86_64-continuous.AppImage | |
OUTPUT_WIN: Editor-win64-continuous.zip | |
OUTPUT_MACOS: Editor-macOS-continuous.zip | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install github-release | |
run: | | |
go install github.com/github-release/github-release@latest | |
echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV | |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH | |
- name: Set environment variables | |
run: | | |
echo "GITHUB_USER=$( echo ${{ github.repository }} | cut -d/ -f1 )" >> $GITHUB_ENV | |
echo "GITHUB_REPO=$( echo ${{ github.repository }} | cut -d/ -f2 )" >> $GITHUB_ENV | |
- name: Move/Create continuous tag | |
run: | | |
git tag --force continuous ${{ github.sha }} | |
git push --tags --force | |
- name: Setup continuous release | |
run: | | |
DESCRIPTION="Triggered on $(date -u '+%Y/%m/%d, %H:%M') UTC by commit ${{ github.sha }} (@${{ github.actor }})" | |
if ! github-release info -t continuous > /dev/null 2>&1; then | |
github-release release \ | |
--tag continuous \ | |
--name "Continuous Build" \ | |
--description "$DESCRIPTION" | |
else | |
github-release edit \ | |
--tag continuous \ | |
--name "Continuous Build" \ | |
--description "$DESCRIPTION" | |
fi | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ${{ github.workspace }} | |
- name: Add ${{ env.OUTPUT_UBUNTU }} to release tag | |
run: | | |
github-release upload \ | |
--tag continuous \ | |
--replace \ | |
--name ${{ env.OUTPUT_UBUNTU }} \ | |
--file ${{ env.OUTPUT_UBUNTU }}/${{ env.OUTPUT_UBUNTU }} | |
- name: Add ${{ env.OUTPUT_WIN }} to release tag | |
run: | | |
github-release upload \ | |
--tag continuous \ | |
--replace \ | |
--name ${{ env.OUTPUT_WIN }} \ | |
--file ${{ env.OUTPUT_WIN }}/${{ env.OUTPUT_WIN }} | |
- name: Add ${{ env.OUTPUT_MACOS }} to release tag | |
run: | | |
github-release upload \ | |
--tag continuous \ | |
--replace \ | |
--name ${{ env.OUTPUT_MACOS }} \ | |
--file ${{ env.OUTPUT_MACOS }}/${{ env.OUTPUT_MACOS }} |