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: 22 - 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: 22 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 release: needs: [steamworks-vote, we-manager, flatpak] 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 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 }}