Skip to content

Update

Update #4

Workflow file for this run

name: Update
on:
workflow_dispatch:
jobs:
update:
name: Update
runs-on: ubuntu-22.04
steps:
- name: Install tools
run: |
sudo apt-get install -y xmlstarlet
- name: Get the latest Ruffle tag
id: tag
env:
GH_TOKEN: ${{ github.token }}
run: |
tag=$(gh --repo ruffle-rs/ruffle release list --limit 1 | cut -f 3)
if [[ -z "$tag" ]]; then
exit 1
fi
echo "tag=$tag" | tee -a $GITHUB_OUTPUT
- name: Calculate version
id: version
run: |
version=$(echo "${{ steps.tag.outputs.tag }}" | sed --regexp-extended 's/nightly-([0-9]+)-0*([0-9]+)-0*([0-9]+)/0.1.0-nightly.\1.\2.\3/')
echo "version=$version" | tee -a $GITHUB_OUTPUT
- name: Calculate date
id: date
run: |
date=$(echo "${{ steps.tag.outputs.tag }}" | sed 's/nightly-//')
echo "date=$date" | tee -a $GITHUB_OUTPUT
- name: Check out Ruffle repo
uses: actions/checkout@v4
with:
repository: ruffle-rs/ruffle
ref: ${{ steps.tag.outputs.tag }}
path: ruffle
- name: Get Ruffle commit
id: commit
working-directory: ruffle
run: |
commit=$(git rev-parse HEAD)
echo "commit=$commit" | tee -a $GITHUB_OUTPUT
- name: Check out Flathub repo
uses: actions/checkout@v4
with:
path: flathub
- name: Update manifest
working-directory: flathub
run: |
if [[ "$(yq '.modules[0].name' rs.ruffle.Ruffle.yaml)" != "ruffle" ]]; then
exit 1
fi
yqblank() {
yq "$1" "$2" | diff -B "$2" - | patch "$2" -
}
yqblank '.modules[0].sources[0].tag = "${{ steps.tag.outputs.tag }}"' rs.ruffle.Ruffle.yaml
yqblank '.modules[0].sources[0].commit = "${{ steps.commit.outputs.commit }}"' rs.ruffle.Ruffle.yaml
- name: Update release patch
working-directory: ruffle
run: |
git apply < ../flathub/patches/release.patch
xmlstarlet ed --inplace --pf \
-i '//component/releases/release[1]' -t elem -n release \
-a '//component/releases/release[1]' -t text -n release -v "\n " \
-s '//component/releases/release[1]' -t attr -n version -v '${{ steps.version.outputs.version }}' \
-s '//component/releases/release[1]' -t attr -n date -v '${{ steps.date.outputs.date }}' \
desktop/packages/linux/rs.ruffle.Ruffle.metainfo.xml
# I can't find a way to add a literal newline with xmlstarlet
sed -i 's/\\n/\n/' desktop/packages/linux/rs.ruffle.Ruffle.metainfo.xml
git diff > ../flathub/patches/release.patch
- name: Update cargo sources
working-directory: flathub
run: |
make regenerate-sources RUFFLE_COMMIT=${{ steps.commit.outputs.commit }}
- name: Show diff
working-directory: flathub
run: |
git diff
- name: Configure git
working-directory: flathub
run: |
git config user.name "RuffleBuild"
git config user.email "[email protected]"
- name: Commit
working-directory: flathub
run: |
git checkout -b update
git add .
git commit -m "Update to ${{ steps.version.outputs.version }}"
git push -u origin update
- name: Push
working-directory: flathub
run: git push -u origin update
- name: Create a PR
working-directory: flathub
env:
GH_TOKEN: ${{ github.token }}
run: |
gh pr create \
-B master -H update \
--title 'Update to ${{ steps.version.outputs.version }}' \
--body 'Automatic update of Ruffle to [${{ steps.version.outputs.version }}](https://github.com/ruffle-rs/ruffle/releases/tag/${{ steps.tag.outputs.tag }}).'