Skip to content

Commit

Permalink
CI: Rework release workflow
Browse files Browse the repository at this point in the history
to build on windows and upload artifact to release
  • Loading branch information
mklabs committed Nov 27, 2022
1 parent 7e6aa0a commit 76e39d8
Showing 1 changed file with 86 additions and 40 deletions.
126 changes: 86 additions & 40 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,59 +1,105 @@
name: package-plugin-workflow

on: workflow_dispatch
env:
PLUGIN_NAME: TargetSystem

on:
release:
types: [released]

workflow_dispatch:
inputs:
TAG_NAME:
description: 'Tag name that the major tag will point to'
required: true

jobs:
package-plugin-job:
runs-on: ubuntu-latest
windows-package-plugin-job:
if: github.actor == 'mklabs'
runs-on: [self-hosted, Windows]

strategy:
matrix:
unreal: ['4.27', '5.0.2', '5.1']
unreal: ['5.1']

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Free disk space
if: ${{ steps.exists.outputs.value == 0 }}
run: |
# time df -h
sudo time swapoff -a
sudo time rm -f /swapfile
sudo time rm -rf /usr/local/lib/android
sudo time rm -rf /usr/share/dotnet
sudo time rm -rf /usr/share/swift
sudo time rm -rf /usr/local/.ghcup
sudo time rm -rf /usr/local/lib/node_modules
sudo time rm -rf /usr/lib/google-cloud-sdk
sudo time rm -rf /opt/pipx
sudo time rm -rf "$AGENT_TOOLSDIRECTORY"
sudo time apt-get clean
sudo time rm -rf /var/lib/apt/lists/*
# time docker rmi $(docker image ls -aq)
# time du --max-depth=3 --threshold=100M -h /usr /opt /var 2>/dev/null | sort -hr
df -h
- name: Run Docker container
run: |
echo ${{ secrets.DOCKER_TOKEN }} | docker login ghcr.io -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
docker run -td --name unreal --user root \
-v ${{ github.workspace }}:/ue4-targetsystemplugin \
--workdir /ue4-targetsystemplugin/TargetSystem \
ghcr.io/epicgames/unreal-engine:dev-slim-${{ matrix.unreal }}
- uses: actions/setup-node@v3
with:
node-version: 16

- name: Installing Linux Dependencies
run: |
docker exec unreal sudo apt-get update
docker exec unreal pip3 install --upgrade pip
- name: Set outputs
id: vars
run: >-
echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
echo "::set-output name=uplugin_version::$(echo 'console.log(JSON.parse(require("fs").readFileSync("./TargetSystem/TargetSystem.uplugin", "utf8")).VersionName)' | node -)"
echo "::set-output name=uplugin_version_name::$(echo 'console.log(JSON.parse(require("fs").readFileSync("./TargetSystem/TargetSystem.uplugin", "utf8")).VersionName.split("+")[0])' | node -)"
- name: Installing UE CLI
run:
docker exec unreal pip3 install ue4cli
- name: Check outputs
run: >-
echo ${{ steps.vars.outputs.sha_short }}
echo ${{ steps.vars.outputs.uplugin_version }}
echo ${{ steps.vars.outputs.uplugin_version_name }}
- name: Store prev ue4 cli root
id: vars-ue4
run: >-
echo "::set-output name=prev_ue4_cli_root::$(ue4 root)"
- name: Configuring UE CLI
run:
docker exec unreal ue4 setroot /home/ue4/UnrealEngine
ue4 setroot "${{ secrets.WIN_UNREAL_ENGINE_ROOT }}UE_${{ matrix.unreal }}"

- name: Package plugin
run: docker exec unreal ue4 package
run: |
ue4 package
mv dist ../dist
working-directory: TargetSystem

- name: Upload source artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.PLUGIN_NAME }}_${{ steps.vars.outputs.uplugin_version_name }}_${{ steps.vars.outputs.sha_short }}
path: |
dist/
!dist/Binaries
!dist/Intermediate
- name: Restore UE CLI Configuration
if: always()
run:
ue4 setroot "${{ steps.vars-ue4.outputs.prev_ue4_cli_root }}"

update-release-artifacts-job:
runs-on: ubuntu-latest
needs: [windows-package-plugin-job]
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: actions/download-artifact@v3
id: download
with:
path: artifacts

- name: Display structure of downloaded files
run: ls -R
working-directory: artifacts

- name: 'Echo download path'
run: echo ${{steps.download.outputs.download-path}}

- name: Zipping artifacts
run: >-
for file in $(ls); do cd $file && zip -r ../$file.zip * && cd ..; done
working-directory: artifacts

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
file: artifacts/*.zip
tag: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
overwrite: true
file_glob: true

0 comments on commit 76e39d8

Please sign in to comment.