Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we deploy to Steam without uploading and downloading the artifact to Github? #59

Open
galfaroth opened this issue Jun 30, 2023 · 6 comments
Labels
question Further information is requested

Comments

@galfaroth
Copy link

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?

@webbertakken
Copy link
Member

Could you elaborate a bit more on what you're trying to do exactly?

@galfaroth
Copy link
Author

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.

@webbertakken
Copy link
Member

You have a few options here:

  • Use a separate step in the same job, so that you can ensure the build and the upload are happening on the same runner. You can remove upload-artifact entirely.
  • In case of a single self-hosted runner you could save the file on the runner itself (as it's effectively not ephemeral)
  • In case of multiple runners I'd recommend using an answer from this discussion https://github.com/orgs/community/discussions/26165. At the time of writing, the answer involves hosting a file server locally. This is most likely your most flexible and scalable solution.

@galfaroth
Copy link
Author

galfaroth commented Jul 2, 2023

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

@davidmfinol davidmfinol added the question Further information is requested label Jul 24, 2023
@davidmfinol
Copy link
Member

davidmfinol commented Jul 24, 2023

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?

@trezy
Copy link

trezy commented Dec 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants