Support Match Day and Campus DLCs (#326) #283
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the master branch | |
# Added 'workflow_dispatch' work manual builds | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build-csm: | |
# Run this on windows | |
runs-on: windows-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
# The version string | |
- name: Set Version Environment Variable | |
id: csm_version | |
run: | | |
"version=$(date +'%y%m').${{ github.run_number }}" >> $env:GITHUB_OUTPUT | |
# Update the assembly version to match the csm version | |
- name: Update Assembly Version | |
run: powershell.exe -NoP -NonI -Command "../scripts/update-version.ps1 -filePattern AssemblyInfo.cs -assemblyVersion ${{ steps.csm_version.outputs.version }}.0.0 -assemblyFileVersion ${{ steps.csm_version.outputs.version }}.0.0" | |
working-directory: src | |
# Download the assemblies required to build the mod | |
- name: Download Assemblies | |
uses: carlosperate/download-file-action@v2 | |
with: | |
file-url: https://gridentertainment.blob.core.windows.net/general-storage/csm/Assemblies.zip | |
# New filename to rename the downloaded file | |
file-name: Assemblies.zip | |
# Extract these assemblies | |
- name: Extract Assemblies | |
run: powershell.exe -NoP -NonI -Command "Expand-Archive 'Assemblies.zip' 'assemblies'" | |
# Build the mod using the built in build script | |
- name: Build Mod | |
run: powershell.exe -NoP -NonI -Command "../scripts/build.ps1 -Build" | |
working-directory: src | |
# Publish artifacts | |
- name: Upload mod DLLs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CSM ${{ steps.csm_version.outputs.version }} | |
path: src/csm/bin/Release/*.dll | |
# Publish install script | |
- name: Upload install script | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CSM ${{ steps.csm_version.outputs.version }} | |
path: scripts/install.ps1 | |
# Pack API package (Nuget) | |
- name: Build nuget API package | |
if: github.ref == 'refs/heads/master' | |
working-directory: src/api | |
run: nuget pack -Properties Configuration=Release -NonInteractive | |
# Publish API package (Nuget) | |
- name: Publish API package | |
if: github.ref == 'refs/heads/master' | |
working-directory: src/api | |
run: nuget push CitiesSkylinesMultiplayer.API.${{ steps.csm_version.outputs.version }}.0.nupkg ${{secrets.NUGET_API_KEY}} -NonInteractive -Source https://api.nuget.org/v3/index.json | |
build-gs: | |
# Run this on linux so it builds the correct docker image | |
runs-on: ubuntu-latest | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
- name: Build Docker Image | |
working-directory: src/gs | |
run: docker build -t ghcr.io/citiesskylinesmultiplayer/apiserver:latest . | |
- name: Save docker image | |
run: docker save -o apiserver.tar ghcr.io/citiesskylinesmultiplayer/apiserver:latest | |
- name: Login to docker registry | |
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
if: github.ref == 'refs/heads/master' | |
- name: Push Docker Image | |
run: docker push ghcr.io/citiesskylinesmultiplayer/apiserver:latest | |
if: github.ref == 'refs/heads/master' | |
- name: Upload Docker Image | |
uses: actions/upload-artifact@v3 | |
with: | |
name: API Server Docker Image | |
path: apiserver.tar |