Skip to content

Fix URLs to always have link text #102

Fix URLs to always have link text

Fix URLs to always have link text #102

Workflow file for this run

name: Emscripten build
on: [push, pull_request]
jobs:
emscripten_build:
name: Emscripten build
runs-on: ubuntu-latest
concurrency:
group: emscripten-build
steps:
- uses: actions/checkout@v4
- name: Install Emscripten
run: |
sudo apt update
sudo apt -q install emscripten pandoc
- name: Find Git version
id: version
run: |
if git describe --exact-match --tags >/dev/null; then
VERSION=$(git describe --exact-match --tags)
VERSION=${VERSION/#sdl-sopwith-/}
else
VERSION=git-$(git rev-parse --short HEAD)
fi
echo "VERSION=$VERSION-js" >> $GITHUB_OUTPUT
# Patch the version in configure.ac:
sed -i "s/\(AC_INIT([^,]*, \)\[[^]]*\], /\1[$VERSION], /" \
configure.ac
- name: build
run: ./embuild.sh
- name: make pkg
run: |
make -C pkg/emscripten
- name: Upload build
uses: actions/upload-artifact@v4
with:
path: "pkg/emscripten/page"
name: sdl-sopwith-${{steps.version.outputs.VERSION}}
- name: Identify deploy folder
id: deploy_folder
run: |
case ${{ github.ref }} in
refs/heads/*)
echo "${{github.ref}}" | \
sed "s/refs.heads./DEPLOY_FOLDER=branch\//; s/.merge//"
;;
refs/pull/*/merge)
sed "s/refs.pull./DEPLOY_FOLDER=prs\//; s/.merge//"
pr=$(echo "${{github.ref}}" | sed "s/refs.pull.//; s/.merge//")
echo "DEPLOY_FOLDER=/prs/$pr"
echo "PR_NUMBER=$pr"
;;
refs/tags/*)
echo "${{github.ref}}" | sed "s/refs.tags./DEPLOY_FOLDER=tags\//"
;;
*)
;;
esac | tee "$GITHUB_OUTPUT"
- name: Deploy
if: ${{steps.deploy_folder.outputs.DEPLOY_FOLDER != ''}}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: "pkg/emscripten/page"
repository-name: "fragglet/sdl-sopwith-builds"
token: "${{secrets.SDL_SOPWITH_LATEST_SECRET}}"
target-folder: "${{steps.deploy_folder.outputs.DEPLOY_FOLDER}}"
clean: true
commit-message: "Build from fragglet/sdl-sopwith@${{github.sha}} (Version ${{steps.version.outputs.VERSION}})"
- name: Comment PR
if: ${{ github.event_name == 'pull_request' }}
uses: thollander/actions-comment-pull-request@v3
with:
message: |
Thanks for your pull request! A build of your change can be found [here](https://fragglet.github.io/sdl-sopwith-builds${{steps.deploy_folder.outputs.DEPLOY_FOLDER}}/sopwith.html) for people to try.
pr_number: ${{steps.deploy_folder.outputs.PR_NUMBER}}