How to build wp2static using composer

I built a primer of using WordPress as a static-site-generator with postmark (for Markdown content) and with wp2static for generating the site content and deploying it to GitHub Pages

As I’m not knowledgeable in PHP world, I hacked through like this:

mkdir -p ./wp-content/plugins/wp2static # php wp-cli.phar plugin path
curl -L https://github.com/elementor/wp2static/archive/refs/tags/7.2.tar.gz | tar -xzf - -C ./wp-content/plugins/wp2static --strip-components=1
cd ./wp-content/plugins/wp2static
curl -o composer.phar https://getcomposer.org/installer
php composer.phar install
php composer.phar update
php composer.phar build
php composer.phar install --quiet --no-dev --optimize-autoloader
cd  ../../../
php ./wp-cli.phar plugin activate wp2static
php ./wp-cli.phar wp2static options set deploymentURL "https://${{github.repository_owner}}.github.io${{steps.pages.outputs.base_path}}/"

I’m sure there is a simpler way (maybe with a proper usage of composer?). Would be very grateful if anyone can help. Thanks! :slight_smile: