Skip to content

Release

Release #12

Workflow file for this run

name: Release
on:
workflow_dispatch:
jobs:
package:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest]
config: [debug, release]
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
fetch-depth: '0'
- uses: benjlevesque/short-sha@v1.2
id: short-sha
with:
length: 7
- name: configure_macos
if: matrix.os == 'macos-latest'
run: mkdir build && cd build && cmake -G Xcode ..
- name: configure_windows
if: matrix.os == 'windows-latest'
run: mkdir build && cd build && cmake ..
- name: build_debug
if: matrix.config == 'debug'
run: cmake --build build --config 'Debug'
- name: build_release
if: matrix.config == 'release'
run: cmake --build build --config 'Release'
- name: test
run: cd build && ctest -C ${{ matrix.config }} . -V
- name: package_macos
if: matrix.os == 'macos-latest'
env:
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_SHA: ${{ github.sha }}
GITHUB_CONFIG: ${{ matrix.config }}
run: |
PACKAGE_NAME=`echo $GITHUB_REPOSITORY | sed 's/.*\///g'`
PACKAGE_REV=`echo $GITHUB_SHA | sed -e 's/^[[:alnum:]]\{7\}/&-/g' | sed 's/-.*//'`
PACKAGE_CONFIG=`echo $GITHUB_CONFIG`
mkdir -p $PACKAGE_NAME
if [ -e package-info.json ]; then cp package-info.json $PACKAGE_NAME; fi
if [ -e package-info.json.in ]; then cp package-info.json.in $PACKAGE_NAME; fi
for f in *.md; do [ -e "$f" ] && cp "$f" $PACKAGE_NAME ; done
if [ -e icon.png ]; then cp icon.png $PACKAGE_NAME; fi
if [ -d code ]; then cp -r code $PACKAGE_NAME; fi
if [ -d docs ]; then cp -r docs $PACKAGE_NAME; fi
if [ -d examples ]; then cp -r examples $PACKAGE_NAME; fi
if [ -d extensions ]; then cp -r extensions $PACKAGE_NAME; fi
if [ -d externals ]; then cp -r externals $PACKAGE_NAME; fi
if [ -d extras ]; then cp -r extras $PACKAGE_NAME; fi
if [ -d help ]; then cp -r help $PACKAGE_NAME; fi
if [ -d init ]; then cp -r init $PACKAGE_NAME; fi
if [ -d java-classes ]; then cp -r java-classes $PACKAGE_NAME; fi
if [ -d java-doc ]; then cp -r java-doc $PACKAGE_NAME; fi
if [ -d javascript ]; then cp -r javascript $PACKAGE_NAME; fi
if [ -d jsui ]; then cp -r jsui $PACKAGE_NAME; fi
if [ -d media ]; then cp -r media $PACKAGE_NAME; fi
if [ -d misc ]; then cp -r misc $PACKAGE_NAME; fi
if [ -d patchers ]; then cp -r patchers $PACKAGE_NAME; fi
if [ -d script ]; then cp -r script $PACKAGE_NAME; fi
if [ -d support ]; then cp -r support $PACKAGE_NAME; fi
if [ -d tests ]; then cp -r tests $PACKAGE_NAME; fi
if [ -e $PACKAGE_NAME/ReadMe-Public.md ]; then rm -f $PACKAGE_NAME/ReadMe.md; mv $PACKAGE_NAME/ReadMe-Public.md $PACKAGE_NAME/ReadMe.md; fi
- name: package_windows
if: matrix.os == 'windows-latest'
shell: cmd
env:
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}
GITHUB_CONFIG: ${{ matrix.config }}
run: |
set PACKAGE_NAME=%GITHUB_REPOSITORY_NAME%
mkdir %PACKAGE_NAME%
if exist extensions cp -r extensions %PACKAGE_NAME%
if exist externals cp -r externals %PACKAGE_NAME%
if exist support cp -r support %PACKAGE_NAME%
if exist tests cp -r tests %PACKAGE_NAME%
- uses: actions/upload-artifact@v2
with:
name: ${{ github.event.repository.name }}-${{ steps.short-sha.outputs.sha }}-${{ matrix.config }}
path: ${{ github.event.repository.name }}
release:
runs-on: ubuntu-latest
needs: package
if: ${{ contains( github.ref, 'refs/tags/' ) }}
steps:
- uses: benjlevesque/short-sha@v1.1
id: short-sha
with:
length: 7
- uses: actions/download-artifact@v2
with:
name: ${{ github.event.repository.name }}-${{ steps.short-sha.outputs.sha }}-release
path: ${{ github.event.repository.name }}
- name: Display structure of downloaded files
run: ls -R
working-directory: ${{ github.event.repository.name }}
- name: zip
run: zip -r ${{ github.event.repository.name }}-package-for-max-${{ steps.short-sha.outputs.sha }}.zip ${{ github.event.repository.name }}
- uses: actions/upload-artifact@v2
with:
name: ${{ github.event.repository.name }}-${{ steps.short-sha.outputs.sha }}-zipped-release
path: ${{ github.event.repository.name }}-package-for-max-${{ steps.short-sha.outputs.sha }}.zip
- uses: ncipollo/release-action@v1.7.1
with:
artifacts: ${{ github.event.repository.name }}-package-for-max-${{ steps.short-sha.outputs.sha }}.zip
body: "Max Package for all supported platforms"
token: ${{ secrets.GITHUB_TOKEN }}