Open galfaroth opened 1 year ago
Could you elaborate a bit more on what you're trying to do exactly?
Hey, im using self hosted Linux and I want not to upload and download artifact from GitHub to save money. Basically my builds are 10-15gb and I prefer to upload to Steam directly.
You have a few options here:
So here's set of actions that I created, what should I change to accomplish the first point? self-hosted, the same machine builds and deploys.
name: Actions 😎
on:
push:
branches:
- build # Your branch goes here
jobs:
buildForWindowsAndOSX:
name: Build my project ✨
runs-on: self-hosted
strategy:
fail-fast: false
matrix:
targetPlatform:
- StandaloneWindows64 # Build a Windows 64-bit standalone.
# - StandaloneLinux64 # Build a Linux 64-bit standalone.
- StandaloneOSX
outputs:
buildVersion: ${{ steps.build.outputs.buildVersion }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true
- uses: actions/cache@v3
with:
path: Library
key:
Library-${{ matrix.targetPlatform }}-${{ hashFiles('Assets/**', 'Packages/**',
'ProjectSettings/**') }}
restore-keys: |
Library-${{ matrix.targetPlatform }}-
Library-
- uses: game-ci/unity-builder@v2
id: build
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_SERIAL: ${{ secrets.UNITY_SERIAL }}
with:
targetPlatform: ${{ matrix.targetPlatform }}
versioning: Semantic
- uses: actions/upload-artifact@v3
with:
name: Build-${{ matrix.targetPlatform }}
path: build/${{ matrix.targetPlatform }}
deployToSteam:
needs: [buildForWindowsAndOSX]
runs-on: self-hosted
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download StandaloneWindows64 Artifact
uses: actions/download-artifact@v3
with:
name: Build-StandaloneWindows64
path: build/StandaloneWindows64
- name: Download StandaloneOSX Artifact
uses: actions/download-artifact@v3
with:
name: Build-StandaloneOSX
path: build/StandaloneOSX
- uses: game-ci/steam-deploy@v3
with:
username: ${{ secrets.STEAM_USERNAME }}
configVdf: ${{ secrets.STEAM_CONFIG_VDF}}
appId: ${{ secrets.STEAM_APP_ID }}
buildDescription: v${{ needs.buildForWindowsAndOSX.outputs.buildVersion }}
rootPath: build
depot1Path: StandaloneWindows64
depot2Path: StandaloneOSX
releaseBranch: yyy
Instead of splitting into 2 jobs, you could run everything on the same job?
IE: delete all the lines after - uses: actions/upload-artifact@v3
and before - uses: game-ci/steam-deploy@v3
Does that work for you?
Just wanted to add my solution to this thread. I'm actually creating a Github Release before I build my app, and then uploading the build assets to the release. Then I download the assets to the new runner when it's time to publish to Steam. It turns out to be much faster than uploading/downloading artefacts, too.
Here's an example workflow (this is untested pseudocode - you'll need to update for your situation, e.g. some of these actions may not work on Windows runners):
name: Publish
on:
push:
branches:
- main
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create a Release
uses: mini-bomba/create-github-release@v1.1.3
with:
body: BUILD_VERSION
name: BUILD_VERSION
tag: BUILD_VERSION
token: ${{ secrets.GITHUB_TOKEN }}
create-build:
runs-on: ubuntu-latest
steps:
- name: Build Your Game Here
run: echo 'Nothing to see here.'
- name: Upload Assets to the Release
uses: mini-bomba/create-github-release@v1.1.3
with:
body: BUILD_VERSION
files: |
build/*.exe
name: BUILD_VERSION
tag: BUILD_VERSION
token: ${{ secrets.GITHUB_TOKEN }}
publish-to-steam:
runs-on: ubuntu-latest
steps:
- name: Download Assets from Release
uses: robinraju/release-downloader@v1.8
with:
fileName: builds
out-file-path: artifacts
repository: ${{ github.repository }}
tag: BUILD_VERSION
token: ${{ github.token }}
- name: Publish to Steam
uses: game-ci/steam-deploy@v3
with:
username: ${{ env.STEAM_BUILD_USERNAME }}
configVdf: ${{ env.STEAM_CONFIG_VDF }}
appId: ${{ env.STEAM_APP_ID }}
buildDescription: BUILD_VERSION
rootPath: builds
depot1Path: .
releaseBranch: prerelease
Basically I want to save money because each GB counts on Github. How to configure so that I don't upload and download the artifact?