Release Nightly #309
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release Nightly | |
permissions: | |
contents: write | |
on: | |
# Run nightly | |
schedule: | |
- cron: "0 0 * * *" | |
# Allow for manual dispatch on GitHub | |
workflow_dispatch: | |
jobs: | |
create-nightly-release: | |
name: Create Nightly Release | |
runs-on: ubuntu-22.04 | |
outputs: | |
is_active: ${{ steps.activity.outputs.is_active }} | |
date: ${{ steps.current_time_underscores.outputs.formattedTime }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
package_prefix: ruffle-nightly-${{ steps.current_time_underscores.outputs.formattedTime }} | |
tag_name: nightly-${{ steps.current_time_dashes.outputs.formattedTime }} | |
# Only run the scheduled workflows on the main repo. | |
if: github.repository == 'ruffle-rs/ruffle' || github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check for repo activity | |
id: activity | |
run: | | |
# Skip activity check when manually triggered. | |
if [ "${{ github.event_name }}" == "repository_dispatch" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
is_active=true | |
elif [ "$(git rev-list --after="24 hours" ${{ github.sha }})" ]; then | |
is_active=true | |
else | |
is_active=false | |
fi | |
echo "is_active=$is_active" >> $GITHUB_OUTPUT | |
- name: Get current time with dashes | |
uses: 1466587594/[email protected] | |
id: current_time_dashes | |
with: | |
format: YYYY-MM-DD-hh-mm-ss | |
- name: Get current time with underscores | |
uses: 1466587594/[email protected] | |
id: current_time_underscores | |
with: | |
format: YYYY_MM_DD_HH_MM_SS | |
- name: Create release | |
if: steps.activity.outputs.is_active == 'true' | |
id: create_release | |
run: | | |
tag_name="nightly-${{ steps.current_time_dashes.outputs.formattedTime }}" | |
release_name="Nightly ${{ steps.current_time_dashes.outputs.formattedTime }}" | |
gh release create "$tag_name" --title "$release_name" --generate-notes --prerelease | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
name: Build ${{ matrix.build_name }} | |
needs: create-nightly-release | |
if: needs.create-nightly-release.outputs.is_active == 'true' | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- build_name: linux-x86_64 | |
os: ubuntu-22.04 | |
env: | |
PACKAGE_FILE: |- | |
${{ needs.create-nightly-release.outputs.package_prefix }}-${{ matrix.build_name }}.${{ | |
startsWith(matrix.build_name, 'macos') && 'dmg' || | |
startsWith(matrix.build_name, 'linux') && 'tar.gz' || | |
'zip' | |
}} | |
CARGO_BUILD_DIR: target/${{ matrix.target }}/release | |
runs-on: ${{ matrix.os }} | |
# Use the oldest still-supported LTS to build the AppImage | |
container: ${{ startsWith(matrix.name, 'linux') && 'ubuntu:20.04' || null }} | |
steps: | |
# Necessary when using an Ubuntu container as it doesn't contain required shell tools | |
- name: Install shell tools (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
apt update | |
apt install -y wget git gh software-properties-common sudo | |
git config --global --add safe.directory * | |
- name: Clone Ruffle repo | |
uses: actions/checkout@v4 | |
- name: Install Rust toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: stable | |
targets: ${{ matrix.target }} | |
- name: Install Linux dependencies | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt-get update | |
sudo apt install -y libasound2-dev libxcb-shape0-dev libxcb-xfixes0-dev libgtk-3-dev libudev-dev | |
- name: Cargo build | |
run: cargo build --locked --package ruffle_desktop --release ${{matrix.DESKTOP_FEATURES && '--features' }} ${{matrix.DESKTOP_FEATURES}} ${{ matrix.target && '--target' }} ${{ matrix.target }} | |
env: | |
RUSTFLAGS: ${{ matrix.RUSTFLAGS }} | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.MIN_MACOS_VERSION }} | |
- name: Package common files | |
run: | | |
mkdir package | |
cp README.md package/README.md | |
cp LICENSE.md package/LICENSE.md | |
- name: Package Windows files | |
if: runner.os == 'Windows' | |
run: | | |
cp ${{ env.CARGO_BUILD_DIR }}/ruffle_desktop.exe package/ruffle.exe | |
7z a ${{ env.PACKAGE_FILE }} ./package/* | |
- name: Create an AppImage (Linux) | |
if: runner.os == 'Linux' | |
run: | | |
sudo add-apt-repository universe | |
sudo apt install libfuse2 | |
wget https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
chmod +x linuxdeploy-x86_64.AppImage | |
# TODO Update this after https://github.com/linuxdeploy/linuxdeploy/pull/288 gets merged | |
mkdir -p AppDir/usr/share | |
cp desktop/packaging/Linux/rs.ruffle.Ruffle.metainfo.xml AppDir/rs.ruffle.Ruffle.appdata.xml | |
cp package/* AppDir/usr/share | |
LDAI_OUTPUT="Ruffle.AppImage" ./linuxdeploy-x86_64.AppImage -e ${{ env.CARGO_BUILD_DIR }}/ruffle_desktop -d desktop/packaging/Linux/rs.ruffle.Ruffle.desktop -i desktop/assets/icon.svg -i desktop/packaging/Linux/icon.png --appdir AppDir --output appimage | |
cp "Ruffle.AppImage" package | |
- name: Package Linux files | |
if: runner.os == 'Linux' | |
run: | | |
# We must enter the package/ directory in order to create a flat tarball (i.e. without a directory in it). | |
cd package | |
tar -czvf ../${{ env.PACKAGE_FILE }} * | |
- name: Upload package | |
if: runner.os != 'macOS' | |
run: gh release upload "${{ needs.create-nightly-release.outputs.tag_name }}" "${{ env.PACKAGE_FILE }}" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Safari Web Extension stub binary | |
if: runner.os == 'macOS' | |
run: cargo build --locked --package ruffle_web_safari --release ${{ matrix.target && '--target' }} ${{ matrix.target }} | |
env: | |
RUSTFLAGS: ${{ matrix.RUSTFLAGS }} | |
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.MIN_MACOS_VERSION }} | |
- name: Upload macOS build artifact | |
if: runner.os == 'macOS' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.build_name }} | |
path: | | |
${{ env.CARGO_BUILD_DIR }}/ruffle_desktop | |
${{ env.CARGO_BUILD_DIR }}/ruffle_web_safari | |
package |