Skip to content

Create Release

Create Release #759

name: Create Release
env:
project: PopH264
on:
#pull_request:
workflow_dispatch:
push:
branches:
- master
- '*Test*'
#gr: testing, but cannot have path AND branch
#paths:
#- '**.json'
#tsdk: need this otherwise it will never make a package later on
tags:
- v*
watch:
types: [started]
jobs:
Build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.runs_on }}
strategy:
matrix:
config:
- name: Linux x64
runs_on: ubuntu-latest
linux_target: linux
arch: x86_64
#- os: ubuntu-latest
# type: Wasm
# nvidia temporarily disabled... compiler out of date?
#- name: Nvidia Linux
# runs_on: Nvidia
# linux_target: Nvidia
# arch: arm64
# - name: Pi4
# runs_on: Raspberry Pi
# linux_target: pi
# arch: arm64
- name: Windows Dll x64
runs_on: windows-latest
BuildPlatform: x64
BuildConfiguration: Release
OutputDirectory: Windows/PopH264_Release_x64
- name: Windows Static x64
runs_on: windows-latest
BuildPlatform: x64
BuildConfiguration: Static
OutputDirectory: Windows/PopH264_Static_x64
- name: Windows Uwp x64
runs_on: windows-latest
BuildPlatform: "x64 Uwp" # Solution platform
BuildConfiguration: Release
OutputDirectory: Windows/PopH264_Uwp_Release_x64
- name: Windows Uwp Arm64
runs_on: windows-latest
BuildPlatform: "ARM64 Uwp" # solution platform
BuildConfiguration: Release
OutputDirectory: Windows/PopH264_Uwp_Arm64
- name: Windows Uwp Arm
runs_on: windows-latest
BuildPlatform: "ARM Uwp" # solution platform
BuildConfiguration: Release
OutputDirectory: Windows/PopH264_Uwp_Arm
- name: Apple Universal
runs_on: macos-12
scheme: PopH264_Universal
destination: "platform=macOS" # has no effect, but gets passed to xcodebuild so will fail if empty (todo: fix in action!)
- name: Ios Framework
runs_on: macos-latest
scheme: PopH264_Ios
destination: "generic/platform=iOS"
- name: Tvos Static
runs_on: macos-latest
scheme: PopH264_TvosStatic
destination: "generic/platform=tvOS"
- name: Macos Static
runs_on: macos-latest
scheme: PopH264_MacosStatic
destination: "generic/platform=macOS"
- name: Macos Dylib
runs_on: macos-latest
scheme: PopH264_MacosDylib
destination: "generic/platform=macOS"
- name: Android
runs_on: ubuntu-latest
type: Android
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: recursive
- name: Configure Windows
if: matrix.config.BuildConfiguration != ''
uses: microsoft/[email protected]
- name: Build Windows ${{ matrix.config.BuildConfiguration }}
id: Windows
if: matrix.config.BuildConfiguration != ''
uses: NewChromantics/[email protected]
with:
BuildSolution: PopH264.visualstudio/PopH264.sln
BuildPlatform: ${{ matrix.config.BuildPlatform }}
BuildConfiguration: ${{ matrix.config.BuildConfiguration }}
OutputDirectory: ${{ github.workspace }}\${{ matrix.config.OutputDirectory }}\ # need an absolute path here, must end with trailing slash
- name: "Import Apple-Distriubution NewChromantics Signing Certificate"
if: matrix.config.scheme != ''
uses: NewChromantics/[email protected]
with:
certificate-data: ${{ secrets.APPLE_DIST_NEWCHROMANTICS_P12 }}
certificate-passphrase: ${{ secrets.APPLE_DIST_NEWCHROMANTICS_PASSWORD }}
keychain-password: "Hello"
- name: Build Apple ${{matrix.config.scheme}}
id: Apple
if: matrix.config.scheme != ''
uses: NewChromantics/[email protected]
with:
BuildScheme: ${{matrix.config.scheme}}
project: ${{ env.project }}
destination: ${{ matrix.config.destination }}
- name: Build Linux ${{ matrix.config.linux_target }}
id: Linux
if: matrix.config.linux_target != ''
uses: NewChromantics/[email protected]
with:
os: ${{ matrix.config.linux_target }}
project: ${{ env.project }}
arch: ${{ matrix.config.arch }}
- name: Build Android Lib
id: Android
if: matrix.config.type == 'Android'
uses: NewChromantics/[email protected]
with:
buildtargetname: ${{ env.project }}
buildpath: ${{ env.project }}.Android/lib${{ env.project }}
- name: Wasm setup emscripten
if: matrix.config.type == 'Wasm'
uses: mymindstorm/setup-emsdk@v7
with:
version: "latest" #"1.39.15"
- name: Build Wasm
id: Wasm
if: matrix.config.type == 'Wasm'
env:
BUILD_TARGET_NAME: PopH264
run: PopH264.Emscripten/Build.sh PopH264.Emscripten/ release
- name: Wasm set artifact output vars
if: matrix.config.type == 'Wasm'
run: |
echo "UPLOAD_NAME=PopH264.Wasm" >> $GITHUB_OUTPUT
echo "UPLOAD_DIR=PopH264.Emscripten/Build" >> $GITHUB_OUTPUT
- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
#name: ${{ steps.Windows.outputs.UPLOAD_NAME }}
name: ${{ matrix.config.name }}
path: ${{ steps.Windows.outputs.UPLOAD_DIR || steps.Linux.outputs.UPLOAD_DIR || steps.Android.outputs.UPLOAD_DIR || steps.Apple.outputs.UPLOAD_DIR }}
if-no-files-found: error
publish-gpr:
needs: Build
runs-on: ubuntu-latest
steps:
# Download project still, for package meta mostly (don't need submodules)
- name: Checkout repo for packaging
uses: actions/checkout@v2
# Download ALL artifacts into Packaging dir
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
path: ${{ env.project }}.Package/
# copy files we want in the release/package into the package dir
# we use this to collate ALL the final files!
- name: Copy files for packaging
run: |
echo Copying files into $PACKAGE_DIR
echo Project is ${{ env.project }}
cp Readme.md $PACKAGE_DIR
cp Source_CSharp/* $PACKAGE_DIR
rsync -avP --exclude PopH264.xcframework/* $PACKAGE_DIR
env:
PACKAGE_DIR: ${{ env.project }}.Package/
# Disabled for now as its giving the error
# PopH264.Package/PopH264.xcframework/macos-x86_64/PopH264_Osx.framework: bundle format is ambiguous (could be app or framework)
# - name: Test xcframework code signing
# run: |
# codesign -vvvv ${{ env.project }}.Package/${{ env.project }}.xcframework/macos-x86_64/${{ env.project }}_Osx.framework
# setup node for npm packaging
- name: Make github package
uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://npm.pkg.github.com/
# set dry-run if this isn't a tag so npm publish will run, but not do anything (and not fail)
- name: Set npm publish as dry-run
if: startsWith(github.ref, 'refs/tags/v') != true
run: echo "NPM_PACKAGE_DRY_RUN=--dry-run" >> $GITHUB_ENV
# copy files we want to
# download github-publish dependencies (ci), then publish from package dir
- name: Publish
working-directory: ${{ env.project }}.Package/
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
run: |
ls
npm publish $NPM_PACKAGE_DRY_RUN
# make a release
# needs to be after the npm package cause this step tars and deletes all the files in the dir which breaks it!
- name: Make github release
# only try and make a release if this is a release (to help testing npm packaging)
if: startsWith(github.ref, 'refs/tags/v')
uses: fnkr/github-action-ghr@v1
env:
GHR_COMPRESS: zip
GHR_PATH: ${{ env.project }}.Package/
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}