Skip to content
This repository has been archived by the owner on May 30, 2024. It is now read-only.

Create nightly artifact #348

Create nightly artifact

Create nightly artifact #348

---
name: Create nightly artifact
on:
schedule:
- cron: "59 23 * * *"
workflow_dispatch:
env:
tar-path: resources.tar.gz
resource-artifact-prefix: "__workflow-resources-"
jobs:
setup-extensions:
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
os-name: windows
- os: ubuntu-latest
os-name: linux
# - os: macos-latest
# os-name: osx
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: recursive
- name: Build default extensions
if: matrix.os != 'macos-latest'
shell: bash
run: |
python -m pip install requests
python scripts/setup_extensions.py --setup --export
- name: Build default extensions
if: matrix.os == 'macos-latest'
shell: bash
run: |
python3 -m pip install requests
python3 scripts/setup_extensions.py --setup --export
- name: Tar to preserve file permissions
shell: bash
run: |
tar -czvf ${{ env.tar-path }} resources
- name: Upload resources
uses: actions/upload-artifact@v3
with:
name: ${{ env.resource-artifact-prefix }}${{ matrix.os-name }}
path: ${{ env.tar-path }}
retention-days: 1 # No reason to retain these
release:
env:
headless-bin-url: "https://github.com/virtual-puppet-project/godot-builds/releases/download/latest/Godot_v3.x-stable_linux_headless.64.tar.gz"
headless-bin: Godot_v3.x-stable_linux_headless.64
release-config: release_config.toml
decompress-windows: decompress.bat
decompress-unix: decompress.sh
decompress-instructions: instructions.txt
strategy:
fail-fast: false
matrix:
include:
- os-name: windows
export-preset-name: windows
release-template-url: "https://github.com/virtual-puppet-project/godot-builds/releases/download/latest/Godot_v3.x-stable_windows_release.64.exe.tar.gz"
resource-path: "$EXE_DIR/resources"
- os-name: linux
export-preset-name: linux
release-template-url: "https://github.com/virtual-puppet-project/godot-builds/releases/download/latest/Godot_v3.x-stable_linux_release.64.tar.gz"
resource-path: "$EXE_DIR/resources"
- os-name: linux
export-preset-name: flatpak
release-template-url: "https://github.com/virtual-puppet-project/godot-builds/releases/download/latest/Godot_v3.x-stable_linux_release.64.tar.gz"
resource-path: "$EXE_DIR/resources"
## Disabled for now since osx templates are not packed correctly
# - os-name: osx
# export-preset-name: osx
runs-on: ubuntu-latest
needs: setup-extensions
steps:
- name: Checkout repo without submodules
uses: actions/checkout@v3
- name: Download Godot binaries
shell: bash
run: |
curl -L ${{ env.headless-bin-url }} -o editor.tar.gz
tar -xzvf editor.tar.gz
chmod +x ${{ env.headless-bin }}
./${{ env.headless-bin }} --editor --quit # Needed to load things once?
mkdir release_templates
cd release_templates
curl -L ${{ matrix.release-template-url }} -o template.tar.gz
tar -xzvf *.tar.gz
- name: Set export path
shell: bash
run: echo "EXPORT_PATH=export/${{ matrix.export-preset-name }}" >> $GITHUB_ENV
- name: Set current date
shell: bash
run: echo "CURRENT_DATETIME=$(date '+%Y-%m-%d_%H-%M-%S')" >> $GITHUB_ENV
- name: Generate ${{ env.release-config }}
shell: bash
run: |
touch ${{ env.release-config }}
echo "resource_path = '\$EXE_DIR/resources'" >> ${{ env.release-config }}
echo "version = 'nightly_${{ env.CURRENT_DATETIME }}'" >> ${{ env.release-config }}
- name: Export project
shell: bash
run: |
mkdir ${{ env.EXPORT_PATH }}
./${{ env.headless-bin }} --export --verbose ${{ matrix.export-preset-name }}
# mv resources ${{ env.EXPORT_PATH }}
- name: Fix executable bit
if: matrix.os-name == 'linux'
shell: bash
run: chmod +x ${{ env.EXPORT_PATH }}/vpuppr.x86_64
- name: Download pre-setup resources
uses: actions/download-artifact@v3
with:
name: ${{ env.resource-artifact-prefix }}${{ matrix.os-name }}
- name: Process resources
shell: bash
run: |
rm -rf resources
tar -xzvf ${{ env.tar-path }} resources
mv resources ${{ env.EXPORT_PATH }}
- name: Set tar name
shell: bash
run: echo "PROJECT_TAR_NAME=vpuppr_nightly_${{ matrix.export-preset-name }}_${{ env.CURRENT_DATETIME }}.tar.gz" >> $GITHUB_ENV
- name: Pack release into tar.gz
shell: bash
run: |
cd export/${{ matrix.export-preset-name }}
tar -czvf ${{ env.PROJECT_TAR_NAME }} *
mv ${{ env.PROJECT_TAR_NAME }} ../..
- name: Create scripts to decompress tar.gz
shell: bash
run: |
echo "tar xzvf ${{ env.PROJECT_TAR_NAME }}" > ${{ env.decompress-windows }}
echo "tar xzvf ${{ env.PROJECT_TAR_NAME }}" > ${{ env.decompress-unix }}
touch ${{ env.decompress-instructions }}
echo "Windows" >> ${{ env.decompress-instructions }}
echo "Double click on ${{ env.decompress-windows }}" >> ${{ env.decompress-instructions }}
echo "" >> ${{ env.decompress-instructions }}
echo "Linux and Mac" >> ${{ env.decompress-instructions }}
echo "Run ${{ env.decompress-unix }} from a terminal" >> ${{ env.decompress-instructions }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: vpuppr_nightly_${{ matrix.export-preset-name }}_${{ env.CURRENT_DATETIME }}
path: |
${{ env.PROJECT_TAR_NAME }}
${{ env.decompress-windows }}
${{ env.decompress-unix }}
${{ env.decompress-instructions }}