| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- name: Build
- on:
- push:
- branches: [main]
- tags: ['v*']
- pull_request:
- workflow_dispatch:
- permissions:
- contents: read
- jobs:
- steamworks-vote:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v7
- - uses: actions/setup-node@v7
- with:
- node-version: 24
- - name: Install clang for bindgen
- run: sudo apt-get update && sudo apt-get install -y clang libclang-dev
- - name: Build patched steamworks.js
- env:
- STEAMWORKSJS_BUILD: build
- run: bash patches/steamworks-vote/build.sh "$RUNNER_TEMP/src"
- - name: Pack
- run: |
- mkdir -p "$RUNNER_TEMP/out"
- cd "$RUNNER_TEMP/src/steamworksjs"
- npm pack --pack-destination "$RUNNER_TEMP/out"
- cp dist/linux64/steamworksjs.linux-x64-gnu.node dist/linux64/libsteam_api.so "$RUNNER_TEMP/out/"
- - uses: actions/upload-artifact@v7
- with:
- name: steamworks-vote
- path: ${{ runner.temp }}/out/*
- if-no-files-found: error
- we-manager:
- needs: steamworks-vote
- # still build the app when the patch build breaks, it just falls back to unconfirmed votes then
- if: ${{ !cancelled() }}
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v7
- - uses: actions/setup-node@v7
- with:
- node-version: 24
- cache: npm
- - run: npm ci
- - name: Say that the patched steamworks.js is missing
- if: ${{ needs.steamworks-vote.result != 'success' }}
- run: echo "::warning::The patched steamworks.js build ended with ${{ needs.steamworks-vote.result }}, this app falls back to unconfirmed votes and favorites"
- - uses: actions/download-artifact@v8
- if: ${{ needs.steamworks-vote.result == 'success' }}
- with:
- name: steamworks-vote
- path: ${{ runner.temp }}/steamworks-vote
- - name: Use patched steamworks.js
- if: ${{ needs.steamworks-vote.result == 'success' }}
- run: npm install --no-save "$RUNNER_TEMP"/steamworks-vote/steamworks.js-*.tgz
- - run: npm run build
- - run: npx electron-builder --linux --publish never
- - uses: actions/upload-artifact@v7
- with:
- name: we-manager
- path: |
- dist/*.AppImage
- dist/*.deb
- if-no-files-found: error
- # the engine's portable tarball for the Flatpak. A tag build only takes a released engine: the newest release that has
- # the tarball, or the one named in the ENGINE_TAG repository variable. Other builds may also take the newest artifact
- # of the engine's CMake workflow (a release only gets the tarball at the end of that run)
- engine-portable:
- runs-on: ubuntu-latest
- outputs:
- found: ${{ steps.fetch.outputs.found }}
- steps:
- - name: Fetch the portable engine
- id: fetch
- env:
- GH_TOKEN: ${{ github.token }}
- ENGINE: WallpaperEngineLover/linux-wallpaperengine-kde
- ASSET: linux-wallpaperengine-kde-portable-x86_64.tar.gz
- ENGINE_TAG: ${{ vars.ENGINE_TAG }}
- RELEASE_BUILD: ${{ startsWith(github.ref, 'refs/tags/v') }}
- run: |
- mkdir -p engine
- tag="$ENGINE_TAG"
- if [ -z "$tag" ]; then
- tag=$(gh api "repos/$ENGINE/releases?per_page=30" \
- --jq "[.[] | select(any(.assets[]; .name == \"$ASSET\"))][0].tag_name // empty")
- fi
- if [ -n "$tag" ]; then
- echo "using release $tag"
- gh release download "$tag" -R "$ENGINE" -p "$ASSET" -D engine
- digest=$(gh api "repos/$ENGINE/releases/tags/$tag" --jq ".assets[] | select(.name == \"$ASSET\") | .digest // empty")
- case "$digest" in
- sha256:*) echo "${digest#sha256:} engine/$ASSET" | sha256sum -c - ;;
- *) echo "::warning::GitHub gave no sha256 for $ASSET of $tag, it was not checked" ;;
- esac
- echo "Flatpak engine: release $tag" >> "$GITHUB_STEP_SUMMARY"
- elif [ "$RELEASE_BUILD" != "true" ]; then
- # the newest unexpired artifact, also from a run that failed later on or is still going
- run=$(gh api "repos/$ENGINE/actions/artifacts?name=linux-wallpaperengine-kde-portable&per_page=10" \
- --jq '[.artifacts[] | select(.expired | not)][0].workflow_run.id // empty')
- if [ -n "$run" ] && gh run download "$run" -R "$ENGINE" -n linux-wallpaperengine-kde-portable -D engine; then
- echo "using the artifact of CMake run $run"
- echo "Flatpak engine: artifact of CMake run $run" >> "$GITHUB_STEP_SUMMARY"
- fi
- fi
- if [ -f "engine/$ASSET" ]; then
- echo "found=true" >> "$GITHUB_OUTPUT"
- else
- echo "::warning::no released portable linux-wallpaperengine-kde build, skipping the Flatpak"
- echo "found=false" >> "$GITHUB_OUTPUT"
- fi
- - uses: actions/upload-artifact@v7
- if: steps.fetch.outputs.found == 'true'
- with:
- name: engine-portable
- path: engine/linux-wallpaperengine-kde-portable-x86_64.tar.gz
- if-no-files-found: error
- # the app's .deb from above plus the portable engine, see packaging/flatpak
- flatpak:
- needs: [we-manager, engine-portable]
- if: needs.engine-portable.outputs.found == 'true'
- runs-on: ubuntu-latest
- container:
- image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
- options: --privileged
- steps:
- - uses: actions/checkout@v7
- - uses: actions/download-artifact@v8
- with:
- name: we-manager
- path: ${{ runner.temp }}/we-manager
- - uses: actions/download-artifact@v8
- with:
- name: engine-portable
- path: packaging/flatpak
- - name: Collect sources
- run: cp "$RUNNER_TEMP"/we-manager/*.deb packaging/flatpak/we-manager.deb
- - uses: flatpak/flatpak-github-actions/flatpak-builder@79327416609af08178ad73b352877e51450790b3 # v6
- with:
- bundle: we-manager.flatpak
- manifest-path: packaging/flatpak/io.github.WallpaperEngineLover.we_manager.yml
- cache-key: flatpak-builder-${{ github.sha }}
- upload-artifact: false
- - uses: actions/upload-artifact@v7
- with:
- name: we-manager-flatpak
- path: we-manager.flatpak
- if-no-files-found: error
- rpm:
- needs: we-manager
- runs-on: ubuntu-latest
- container: fedora:44
- steps:
- - name: Install the rpm tools
- run: dnf install -y rpm-build rpmlint binutils tar xz desktop-file-utils
- - uses: actions/checkout@v7
- - uses: actions/download-artifact@v8
- with:
- name: we-manager
- path: ${{ runner.temp }}/we-manager
- - name: Build the rpm from the release .deb
- run: |
- version=$(sed -n 's/^ "version": "\(.*\)",/\1/p' package.json)
- sed -i "s/^Version:.*/Version: ${version//-/\~}/; s/^%global upstream_version .*/%global upstream_version $version/" packaging/rpm/we-manager.spec
- mkdir -p "$RUNNER_TEMP/rpm/SOURCES"
- cp "$RUNNER_TEMP"/we-manager/*.deb "$RUNNER_TEMP/rpm/SOURCES/"
- rpmbuild -bb --define "_topdir $RUNNER_TEMP/rpm" --define "_build_id_links none" packaging/rpm/we-manager.spec
- mkdir -p dist-rpm
- cp "$RUNNER_TEMP"/rpm/RPMS/x86_64/*.rpm dist-rpm/
- - name: rpmlint
- run: rpmlint -r packaging/rpm/we-manager.rpmlintrc dist-rpm/*.rpm packaging/rpm/we-manager.spec || true
- - uses: actions/upload-artifact@v7
- with:
- name: we-manager-rpm
- path: dist-rpm/*.rpm
- if-no-files-found: error
- release:
- needs: [steamworks-vote, we-manager, flatpak, rpm]
- if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/v') && needs.we-manager.result == 'success' }}
- runs-on: ubuntu-latest
- permissions:
- contents: write
- steps:
- - uses: actions/checkout@v7
- - name: Check tag matches package.json version
- run: |
- version=$(node -p "require('./package.json').version")
- if [ "v$version" != "$GITHUB_REF_NAME" ]; then
- echo "tag $GITHUB_REF_NAME does not match package.json version $version"
- exit 1
- fi
- - uses: actions/download-artifact@v8
- with:
- path: release
- merge-multiple: true
- - name: Create release
- env:
- GH_TOKEN: ${{ github.token }}
- STEAMWORKS_RESULT: ${{ needs.steamworks-vote.result }}
- run: |
- notes=()
- if [ "$STEAMWORKS_RESULT" != "success" ]; then
- echo "::warning::The patched steamworks.js build ended with $STEAMWORKS_RESULT, this release has unconfirmed votes and favorites"
- notes=(--notes "> **Built without the patched steamworks.js** (its build ended with \`$STEAMWORKS_RESULT\`): likes, dislikes and favorites are not confirmed by Steam in this release.")
- fi
- gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes "${notes[@]}" \
- release/*.AppImage release/*.deb $(ls release/steamworks.js-*.tgz release/*.flatpak release/*.rpm 2>/dev/null)
- aur:
- needs: release
- # pre-release tags are no valid pkgver
- if: ${{ !contains(github.ref_name, '-') }}
- runs-on: ubuntu-latest
- env:
- HAS_AUR_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY != '' }}
- steps:
- - uses: actions/checkout@v7
- - name: Set the version
- run: sed -i -e "s/^pkgver=.*/pkgver=${GITHUB_REF_NAME#v}/" -e "s/^pkgrel=.*/pkgrel=1/"
- packaging/aur/we-manager-bin/PKGBUILD
- - name: Publish we-manager-bin to the AUR
- if: env.HAS_AUR_KEY == 'true'
- uses: KSXGitHub/github-actions-deploy-aur@2ac5a4c1d7035885d46b10e3193393be8460b6f1 # v4.1.1
- with:
- pkgname: we-manager-bin
- pkgbuild: ./packaging/aur/we-manager-bin/PKGBUILD
- updpkgsums: true
- commit_username: ${{ secrets.AUR_USERNAME }}
- commit_email: ${{ secrets.AUR_EMAIL }}
- ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
- commit_message: Update to ${{ github.ref_name }}
|