Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion .github/scripts/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ def get_current_day_id():
return f'{now.year - 2000}{day}'


def get_max_day_id():
max_year = 2999
max_day = 999
return f'{max_year - 2000}{max_day}'


def get_tag_name(version):
if '-nightly.' in version:
# TODO Nightly versions use a different tag syntax, unify it.
Expand Down Expand Up @@ -148,7 +154,7 @@ def bump(release_type):
# Even for standard versions we have to add the day ID to version4,
# because otherwise a stable version would be older than a pre-release
# version (that's because in version4, 1.2.3 < 1.2.3.4).
version4 = f'{version}.{get_current_day_id()}'
version4 = f'{version}.{get_max_day_id()}'
elif release_type == 'nightly':
# Nightly is our custom pre-release version. We basically get the next
# minor version (by bumping it and resetting) and add suffix manually
Expand Down
59 changes: 43 additions & 16 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ on:

# Allow for manual dispatch on GitHub
workflow_dispatch:
inputs:
release_type:
type: choice
description: Choose release type
options:
- nightly
- minor
- patch
- major

env:
RELEASE_SCRIPT: ./.github/scripts/release.py
Expand All @@ -22,6 +31,7 @@ jobs:
package_prefix: ${{ steps.create_release.outputs.package_prefix }}
tag_name: ${{ steps.commit.outputs.tag_name }}
version4: ${{ steps.version.outputs.version4 }}
release_channel: ${{ steps.configure.outputs.release_channel }}

# 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'
Expand All @@ -32,15 +42,23 @@ jobs:
- name: Configure release
id: configure
run: |
# Skip activity check when manually triggered.
if [ "${{ github.event_name }}" == "repository_dispatch" ] || [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
enabled=true
elif [ "$(git rev-list --after="24 hours" ${{ github.sha }})" ]; then
enabled=true
enabled=true
if [[ "${{ github.event.inputs.release_type }}" == "nightly" ]]; then
release_channel=nightly
release_type=nightly
elif [[ -n "${{ github.event.inputs.release_type }}" ]]; then
release_channel=stable
release_type="${{ github.event.inputs.release_type }}"
elif [[ "${{ github.event.schedule }}" == '0 0 * * *' && "$(git rev-list --after="24 hours" ${{ github.sha }})" ]]; then
release_channel=nightly
release_type=nightly
else
enabled=false
release_channel=
fi
echo "enabled=$enabled" | tee -a $GITHUB_OUTPUT
echo "release_channel=$release_channel" | tee -a $GITHUB_OUTPUT
echo "release_type=$release_type" | tee -a $GITHUB_OUTPUT

- name: Install cargo-edit
uses: baptiste0928/cargo-install@v3
Expand All @@ -58,7 +76,7 @@ jobs:
if: steps.configure.outputs.enabled == 'true'
id: version
run: |
$RELEASE_SCRIPT bump nightly
$RELEASE_SCRIPT bump "${{ steps.configure.outputs.release_type }}"
# Ensure newlines at the end of file
shopt -s globstar
sed -i -e '$a\' **/package.json
Expand All @@ -75,6 +93,11 @@ jobs:
$RELEASE_SCRIPT commit
$RELEASE_SCRIPT tag-and-push origin

- name: Update branch
if: steps.configure.outputs.enabled == 'true' && steps.configure.outputs.release_type != 'nightly'
run: |
git push

- name: Get current time with underscores
uses: josStorer/get-current-time@v2.1.2
id: current_time_underscores
Expand Down Expand Up @@ -163,7 +186,7 @@ jobs:
- name: Cargo build
run: cargo build --locked --package ruffle_desktop --release ${{matrix.DESKTOP_FEATURES && '--features' }} ${{matrix.DESKTOP_FEATURES}} ${{ matrix.target && '--target' }} ${{ matrix.target }}
env:
CFG_RELEASE_CHANNEL: nightly
CFG_RELEASE_CHANNEL: ${{ needs.create-release.outputs.release_channel }}
RUSTFLAGS: ${{ matrix.RUSTFLAGS }}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.MACOSX_DEPLOYMENT_TARGET }}

Expand Down Expand Up @@ -213,7 +236,7 @@ jobs:
if: runner.os == 'macOS'
run: cargo build --locked --package ruffle_web_safari --release ${{ matrix.target && '--target' }} ${{ matrix.target }}
env:
CFG_RELEASE_CHANNEL: nightly
CFG_RELEASE_CHANNEL: ${{ needs.create-release.outputs.release_channel }}
RUSTFLAGS: ${{ matrix.RUSTFLAGS }}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.MACOSX_DEPLOYMENT_TARGET }}

Expand Down Expand Up @@ -408,15 +431,15 @@ jobs:
shell: bash -l {0}
working-directory: web
env:
CFG_RELEASE_CHANNEL: nightly
CFG_RELEASE_CHANNEL: ${{ needs.create-release.outputs.release_channel }}
VERSION4: ${{ needs.create-release.outputs.version4 }}
ENABLE_VERSION_SEAL: "true"
FIREFOX_EXTENSION_ID: ${{ secrets.FIREFOX_EXTENSION_ID }} # Needed to inject into manifest.json
run: npm run version-seal

- name: Build web
env:
CFG_RELEASE_CHANNEL: nightly
CFG_RELEASE_CHANNEL: ${{ needs.create-release.outputs.release_channel }}
VERSION4: ${{ needs.create-release.outputs.version4 }}
# NOTE: In the future, we might want to enable some features (like `webgpu`) only in
# the demo build, for limited testing (like a Chrome origin trial) on ruffle.rs.
Expand Down Expand Up @@ -469,7 +492,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Chrome extension
if: env.CHROME_EXTENSION_ID != ''
if: env.CHROME_EXTENSION_ID != '' && needs.create-release.outputs.release_channel == 'nightly'
id: publish-chrome-extension
continue-on-error: true
env:
Expand All @@ -483,7 +506,7 @@ jobs:
file-path: ./web/packages/extension/dist/ruffle_extension.zip

- name: Publish Edge extension
if: env.EDGE_PRODUCT_ID != ''
if: env.EDGE_PRODUCT_ID != '' && needs.create-release.outputs.release_channel == 'nightly'
id: publish-edge-extension
continue-on-error: true
env:
Expand All @@ -496,7 +519,7 @@ jobs:
api-key: ${{ secrets.EDGE_API_KEY }}

- name: Publish Firefox extension
if: env.FIREFOX_EXTENSION_ID != ''
if: env.FIREFOX_EXTENSION_ID != '' && needs.create-release.outputs.release_channel == 'nightly'
id: publish-firefox-extension
continue-on-error: true
env:
Expand Down Expand Up @@ -533,6 +556,7 @@ jobs:

- name: Clone JS docs
uses: actions/checkout@v6
if: needs.create-release.outputs.release_channel == 'nightly'
with:
repository: ruffle-rs/js-docs
path: js-docs
Expand All @@ -541,6 +565,7 @@ jobs:
persist-credentials: false # Needed to allow commit via RUFFLE_BUILD_TOKEN below

- name: Update JS docs
if: needs.create-release.outputs.release_channel == 'nightly'
run: |
# Delete the old docs
rm -rf master/
Expand All @@ -556,7 +581,7 @@ jobs:
working-directory: js-docs

- name: Push JS docs
if: github.repository == 'ruffle-rs/ruffle'
if: github.repository == 'ruffle-rs/ruffle' && needs.create-release.outputs.release_channel == 'nightly'
uses: ad-m/github-push-action@master
with:
repository: ruffle-rs/js-docs
Expand All @@ -566,6 +591,7 @@ jobs:

- name: Clone web demo
uses: actions/checkout@v6
if: needs.create-release.outputs.release_channel == 'nightly'
with:
repository: ruffle-rs/demo
path: demo
Expand All @@ -574,6 +600,7 @@ jobs:
persist-credentials: false # Needed to allow commit via RUFFLE_BUILD_TOKEN below

- name: Update web demo
if: needs.create-release.outputs.release_channel == 'nightly'
run: |
# Delete the old build.
rm -fr *
Expand All @@ -592,7 +619,7 @@ jobs:
working-directory: demo

- name: Push web demo
if: github.repository == 'ruffle-rs/ruffle'
if: github.repository == 'ruffle-rs/ruffle' && needs.create-release.outputs.release_channel == 'nightly'
uses: ad-m/github-push-action@master
with:
repository: ruffle-rs/demo
Expand All @@ -604,7 +631,7 @@ jobs:
name: Publish AUR package
needs: [create-release, build]
runs-on: ubuntu-24.04
if: github.repository == 'ruffle-rs/ruffle'
if: github.repository == 'ruffle-rs/ruffle' && needs.create-release.outputs.release_channel == 'nightly'
steps:
- uses: actions/checkout@v6
with:
Expand Down
Loading