Skip to content

Release 30

Release 30 #37

name: Generate Github Release Zip
env:
# Change this to what you want your folder name to be in people's Mods/
# folder. It should be unique to your mod.
MOD_NAME: MeleeAnimation
# These two environment variables control whether all releases created by the
# release job are drafts or prereleases.
RELEASE_DRAFT: false
RELEASE_PRERELEASE: false
MOD_CONTENTS: |
About/
Animations/
Bundles/
WeaponTweakData/
Defs/
Patches/
Languages/
Patch_AlienRaces/
Patch_FacialAnimation/
Patch_Lightsabers/
Patch_CAI5000/
Patch_CombatExtended/
Sounds/
Textures/
loadfolders.xml
on:
push:
tags:
# This will only run the release workflow when it's tagged with a version
# tag.
- 'v*'
jobs:
build:
name: Build for RW v${{ matrix.rimworld-version }}
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
# You only need one platform for building the release since the DLLs are
# cross-platform using mono. I chose Ubuntu because it ran the fastest
# for the build steps.
operating-system: [ubuntu-latest]
rimworld-version: [1.4, 1.5] # Add Rimworld version here!
steps:
- name: Checkout Repository
uses: actions/[email protected]
- name: Setup Dotnet
uses: actions/[email protected]
with:
dotnet-version: 8.0.x
- name: Build Mod (RW ${{ matrix.rimworld-version }})
run: dotnet build Source/${{ matrix.rimworld-version }} --configuration Release
# To modify this with your own directory structure, just change the paths to
# whatever you want. It will not upload any empty directories, those with only
# hidden files will also be excluded.
- name: Upload Mod Artifacts (RW ${{ matrix.rimworld-version }})
uses: actions/[email protected]
with:
name: build-${{ matrix.rimworld-version }}
retention-days: 1
path: |
${{ matrix.rimworld-version }}/
${{ env.MOD_CONTENTS }}
!**/.*
# This final path is to exclude hidden files such as .gitkeep and .DS_STORE.
# I would recommend keeping it, but I don't think it will break anything if
# you remove or modify it.
package:
name: Package
needs: build
runs-on: ubuntu-latest
steps:
- name: Set Environment Variables
# This is a special syntax for GitHub Actions that sets an environment
# variable. See: https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
run: echo "MOD_PATH=$HOME/$MOD_NAME" >> $GITHUB_ENV
- name: Create Mod Folder
run: mkdir -p ${{ env.MOD_PATH }}
- name: Download Mod Artifacts from Build Step
uses: actions/[email protected]
with:
# Note that 'name' is not specified, this will cause all artifacts from this run to be downloaded.
merge-multiple: true # Important, this merges the different rimworld version outputs
path: ${{ env.MOD_PATH }}
- name: Zip Mod
run: |
cd $HOME
sudo apt install zip
zip -r ./${{ env.MOD_NAME }}.zip ./${{ env.MOD_NAME }}/*
- name: Upload Mod Zip Artifact
uses: actions/[email protected]
with:
name: ${{ env.MOD_NAME }}
path: ${{ env.MOD_PATH }}.zip
retention-days: 5
release:
name: Release
needs: package
runs-on: ubuntu-latest
steps:
# This extracts the tag name (from github.ref) and uses it as a version
- name: Get the Version
id: get_version
run: echo "VERSION=$(echo ${{ github.ref }} | cut -d / -f 3)" >> $GITHUB_OUTPUT
# Set the release name to the mod name and the version from the step above.
- name: Set Environment Variables
run: echo "MOD_RELEASE=$MOD_NAME-${{ steps.get_version.outputs.VERSION }}" >> $GITHUB_ENV
# The repository needs to be checked out for the next changelog step.
- name: Checkout Repository
uses: actions/[email protected]
# Download the build artifact from the package job.
- name: Download Mod Artifacts from Build Step
id: download_zip
uses: actions/[email protected]
with:
name: ${{ env.MOD_NAME }}
# Auto-generate changelog.
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v5
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ env.MOD_RELEASE }}
body: ${{ steps.github_release.outputs.changelog }}
# These can be configured at the top of the workflow.
draft: ${{ env.RELEASE_DRAFT }}
prerelease: ${{ env.RELEASE_PRERELEASE }}
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.CI_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ steps.download_zip.outputs.download-path }}/${{ env.MOD_NAME }}.zip
asset_name: ${{ env.MOD_RELEASE }}.zip
asset_content_type: application/zip