Bumps the actions group with 6 updates: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `3` | `4` | | [actions/cache](https://github.com/actions/cache) | `3` | `4` | | [peter-evans/repository-dispatch](https://github.com/peter-evans/repository-dispatch) | `2` | `3` | | [actions/download-artifact](https://github.com/actions/download-artifact) | `3` | `4` | | [Apple-Actions/import-codesign-certs](https://github.com/apple-actions/import-codesign-certs) | `2` | `3` | | [softprops/action-gh-release](https://github.com/softprops/action-gh-release) | `0.1.15` | `2.0.5` | Updates `actions/checkout` from 3 to 4 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) Updates `actions/cache` from 3 to 4 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v3...v4) Updates `peter-evans/repository-dispatch` from 2 to 3 - [Release notes](https://github.com/peter-evans/repository-dispatch/releases) - [Commits](https://github.com/peter-evans/repository-dispatch/compare/v2...v3) Updates `actions/download-artifact` from 3 to 4 - [Release notes](https://github.com/actions/download-artifact/releases) - [Commits](https://github.com/actions/download-artifact/compare/v3...v4) Updates `Apple-Actions/import-codesign-certs` from 2 to 3 - [Release notes](https://github.com/apple-actions/import-codesign-certs/releases) - [Commits](https://github.com/apple-actions/import-codesign-certs/compare/v2...v3) Updates `softprops/action-gh-release` from 0.1.15 to 2.0.5 - [Release notes](https://github.com/softprops/action-gh-release/releases) - [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md) - [Commits](https://github.com/softprops/action-gh-release/compare/v0.1.15...v2.0.5) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/cache dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: peter-evans/repository-dispatch dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/download-artifact dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: Apple-Actions/import-codesign-certs dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: softprops/action-gh-release dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
134 lines
4.2 KiB
YAML
134 lines
4.2 KiB
YAML
name: Preview build
|
|
|
|
on:
|
|
repository_dispatch:
|
|
types:
|
|
- Preview*
|
|
|
|
jobs:
|
|
preview:
|
|
name: Build preview
|
|
|
|
runs-on: ubuntu-20.04
|
|
container:
|
|
# If you change this version, change the number in the cache step too.
|
|
image: emscripten/emsdk:3.1.28
|
|
|
|
steps:
|
|
- name: Update deployment status to in progress
|
|
uses: octokit/request-action@v2.x
|
|
with:
|
|
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
|
mediaType: |
|
|
previews:
|
|
- ant-man
|
|
- flash
|
|
owner: ${{ github.event.repository.owner.login }}
|
|
repo: ${{ github.event.repository.name }}
|
|
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
|
state: in_progress
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: ${{ github.event.client_payload.sha }}
|
|
|
|
- name: Name branch
|
|
run: |
|
|
name=$(echo "${{ github.event.client_payload.folder }}")
|
|
git checkout -b ${name}
|
|
|
|
- name: Setup cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: /emsdk/upstream/emscripten/cache
|
|
key: 3.1.28-${{ runner.os }}
|
|
|
|
- name: Patch Emscripten to support LZMA
|
|
run: |
|
|
cd /emsdk/upstream/emscripten
|
|
patch -p1 < ${GITHUB_WORKSPACE}/os/emscripten/emsdk-liblzma.patch
|
|
|
|
- name: Build (host tools)
|
|
run: |
|
|
mkdir build-host
|
|
cd build-host
|
|
|
|
echo "::group::CMake"
|
|
cmake .. -DOPTION_TOOLS_ONLY=ON
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Build"
|
|
echo "Running on $(nproc) cores"
|
|
make -j$(nproc) tools
|
|
echo "::endgroup::"
|
|
|
|
- name: Install GCC problem matcher
|
|
uses: ammaraskar/gcc-problem-matcher@master
|
|
|
|
- name: Build
|
|
run: |
|
|
mkdir build
|
|
cd build
|
|
|
|
echo "::group::CMake"
|
|
emcmake cmake .. \
|
|
-DHOST_BINARY_DIR=../build-host \
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
# EOF
|
|
echo "::endgroup::"
|
|
|
|
echo "::group::Build"
|
|
echo "Running on $(nproc) cores"
|
|
emmake make -j$(nproc)
|
|
echo "::endgroup::"
|
|
|
|
- name: Publish preview
|
|
run: |
|
|
pip3 install awscli
|
|
|
|
aws s3 cp --only-show-errors build/openttd.data s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
|
aws s3 cp --only-show-errors build/openttd.html s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
|
aws s3 cp --only-show-errors build/openttd.js s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
|
aws s3 cp --only-show-errors build/openttd.wasm s3://${{ secrets.PREVIEW_S3_BUCKET }}/${{ github.event.client_payload.folder }}/
|
|
|
|
# Invalidate the cache of the CloudFront distribution
|
|
aws cloudfront create-invalidation --distribution-id ${{ secrets.PREVIEW_CF_DISTRIBUTION_ID }} --paths "/${{ github.event.client_payload.folder }}/*"
|
|
env:
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
- name: Update deployment status to success
|
|
uses: octokit/request-action@v2.x
|
|
with:
|
|
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
|
mediaType: |
|
|
previews:
|
|
- ant-man
|
|
- flash
|
|
owner: ${{ github.event.repository.owner.login }}
|
|
repo: ${{ github.event.repository.name }}
|
|
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
|
state: success
|
|
environment_url: https://preview.openttd.org/${{ github.event.client_payload.folder }}/
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|
|
|
|
- if: failure()
|
|
name: Update deployment status to failure
|
|
uses: octokit/request-action@v2.x
|
|
with:
|
|
route: POST /repos/{owner}/{repo}/deployments/{deployment_id}/statuses
|
|
mediaType: |
|
|
previews:
|
|
- ant-man
|
|
- flash
|
|
owner: ${{ github.event.repository.owner.login }}
|
|
repo: ${{ github.event.repository.name }}
|
|
deployment_id: ${{ github.event.client_payload.deployment_id }}
|
|
state: failure
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.PREVIEW_GITHUB_TOKEN }}
|