Remove data/thing ignore #27
Workflow file for this run
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: Build - Windows | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
env: | |
CMAKE_BUILD_PARALLEL_LEVEL: 2 | |
MAKEFLAGS: '-j 2' | |
jobs: | |
build: | |
name: ${{ matrix.os }}-${{ matrix.buildtype }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [windows-2022] | |
buildtype: [windows-release] | |
include: | |
- os: windows-2022 | |
triplet: x64-windows | |
packages: > | |
sccache #magic___^_^___line | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@main | |
- name: CCache | |
uses: hendrikmuhs/ccache-action@main | |
with: | |
max-size: "1G" | |
variant: "sccache" | |
key: ccache-${{ matrix.os }}-${{ matrix.buildtype }} | |
restore-keys: | | |
ccache-${{ matrix.os }} | |
- name: Restore artifacts and install vcpkg | |
id: vcpkg-step | |
run: | | |
$json=Get-Content vcpkg.json -Raw | ConvertFrom-Json | |
$vcpkgCommitId=$json.'builtin-baseline' | |
Write-Host "vcpkg commit ID: $vcpkgCommitId" | |
echo "vcpkgGitCommitId=$vcpkgCommitId" >> "$GITHUB_OUTPUT" | |
- name: Get vcpkg commit id from vcpkg.json | |
uses: lukka/run-vcpkg@main | |
with: | |
vcpkgGitURL: "https://github.com/microsoft/vcpkg.git" | |
vcpkgGitCommitId: ${{ steps.vcpkg-step.outputs.vcpkgGitCommitId }} | |
- name: Get latest CMake and ninja | |
uses: lukka/get-cmake@main | |
- name: Run CMake | |
uses: lukka/run-cmake@main | |
with: | |
configurePreset: ${{ matrix.buildtype }} | |
buildPreset: ${{ matrix.buildtype }} | |
- name: Create and Upload Artifact (exe) | |
uses: actions/upload-artifact@main | |
with: | |
name: otclient-${{ matrix.os }}-${{ matrix.buildtype }}-${{ github.sha }} | |
path: | | |
${{ github.workspace }}/otclient.exe | |
- name: Create Temporary Directory | |
run: | | |
$tempDir = "$env:GITHUB_WORKSPACE/client" | |
New-Item -Path $tempDir -ItemType Directory -Force | |
- name: Move Files to Temporary Directory | |
run: | | |
Copy-Item -Path "$env:GITHUB_WORKSPACE/data" -Destination "$env:GITHUB_WORKSPACE/client/data" -Recurse -Force | |
Copy-Item -Path "$env:GITHUB_WORKSPACE/mods" -Destination "$env:GITHUB_WORKSPACE/client/mods" -Recurse -Force | |
Copy-Item -Path "$env:GITHUB_WORKSPACE/modules" -Destination "$env:GITHUB_WORKSPACE/client/modules" -Recurse -Force | |
Copy-Item -Path "$env:GITHUB_WORKSPACE/init.lua" -Destination "$env:GITHUB_WORKSPACE/client/init.lua" -Force | |
Copy-Item -Path "$env:GITHUB_WORKSPACE/otclient.exe" -Destination "$env:GITHUB_WORKSPACE/client/otclient.exe" -Force | |
- name: Upload Temporary Directory as Artifact | |
uses: actions/upload-artifact@main | |
with: | |
name: release-${{ matrix.os }}-${{ matrix.buildtype }}-${{ github.sha }} | |
path: ${{ github.workspace }}/client.zip | |
- name: Compress Temporary Directory | |
run: | | |
Compress-Archive -Path "$env:GITHUB_WORKSPACE/client" -DestinationPath "$env:GITHUB_WORKSPACE/client.zip" | |
- name: Create Release | |
id: create_release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ github.ref_name }} | |
release_name: Release ${{ github.ref_name }} | |
body: | | |
Automatically generated release for tag ${{ github.ref_name }}. | |
draft: false | |
prerelease: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
- name: Upload Windows Release Asset | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ github.workspace }}/client.zip | |
asset_name: release-${{ matrix.os }}-${{ matrix.buildtype }}-${{ github.sha }}.zip | |
asset_content_type: application/zip | |
- name: Clean Up | |
run: | | |
Remove-Item -Path "$env:GITHUB_WORKSPACE/client" -Recurse -Force | |
Remove-Item -Path "$env:GITHUB_WORKSPACE/client.zip" -Force |