Refactor actions and workflows

It turns out that workflows were the wrong way to abstract reusable
pieces of work.  This turns common steps into custom actions (build
docs, build packager, test packager) which can be used as encapsulated
steps in multiple workflows.

This is a much more natural way to avoid duplication compared to the
previous approach of triggering one workflow from another.  This also
has the benefit of all of the steps of a release being represented on
GitHub as a single workflow, making it easier to understand what is
happening and what event triggered those steps.

Change-Id: Ife156d60069a39594c7b3bb3bc32080e6453b544
This commit is contained in:
Joey Parrish 2021-06-16 21:32:05 -07:00
parent 53c39ef9ac
commit a2e07a901e
11 changed files with 433 additions and 302 deletions

View File

@ -1,23 +1,33 @@
# GitHub Actions CI # GitHub Actions CI
## Actions
- `custom-actions/build-packager`:
Builds Shaka Packager. Leaves build artifacts in the "artifacts" folder.
Requires OS-dependent and build-dependent inputs.
- `custom-actions/test-packager`:
Tests Shaka Packager. Requires OS-dependent and build-dependent inputs.
- `custom-actions/build-docs`:
Builds Shaka Packager docs.
## Workflows ## Workflows
- On PR: - On PR:
- `build_and_test.yaml`: builds and tests all combinations of OS & build - `build_and_test.yaml`:
settings Builds and tests all combinations of OS & build settings. Also builds
- `update_docs.yaml`: builds updated docs docs.
- On release tag: - On release tag:
- `draft_github_release.yaml`: creates a draft release on GitHub, triggers - `github_release.yaml`:
common `build_and_test` workflow Creates a draft release on GitHub, builds and tests all combinations of OS
- `build_and_test.yaml` builds and tests all combinations of OS & build & build settings, builds docs on all OSes, attaches static release binaries
settings, attaches official binaries to the GitHub draft release, triggers to the draft release, then fully publishes the release.
`publish_github_release` workflow - On release published:
- `publish_github_release.yaml`: finalizes the draft and published the GitHub - `docker_hub_release.yaml`:
release Builds a Docker image to match the published GitHub release, then pushes it
- `docker_hub_release.yaml`: builds a Docker image to match the final GitHub to Docker Hub.
release and pushes it to Docker Hub - `npm_release.yaml`:
- `npm_release.yaml`: builds an NPM package to match the final GitHub release Builds an NPM package to match the published GitHub release, then pushes it
and pushes it to NPM to NPM.
- `update_docs.yaml`: builds updated docs, pushes them to the gh-pages branch - `update_docs.yaml`:
Builds updated docs and pushes them to the gh-pages branch.
## Required Repo Secrets ## Required Repo Secrets
- `DOCKERHUB_CI_USERNAME`: The username of the Docker Hub CI account - `DOCKERHUB_CI_USERNAME`: The username of the Docker Hub CI account

View File

@ -1,16 +1,9 @@
name: Build and Test name: Build and Test PR
# Builds and tests on all combinations of OS, build type, and library type. # Builds and tests on all combinations of OS, build type, and library type.
# Also builds the docs.
# #
# Runs when a pull request is opened, or triggered from other workflows. # Runs when a pull request is opened or updated.
#
# If triggered from another workflow, optionally attaches release artifacts to a
# release, since those artifacts can't be accessed from another workflow later.
#
# If triggered from another workflow, optionally initiates another workflow
# afterward, allowing for chaining of workflows. This capability is used in the
# release process, so that the relatively-complex build_and_test workflow can be
# reused in the middle of the release process without duplication.
# #
# Can also be run manually for debugging purposes. # Can also be run manually for debugging purposes.
on: on:
@ -21,16 +14,6 @@ on:
ref: ref:
description: "The ref to build and test." description: "The ref to build and test."
required: False required: False
release_id:
description: "The ID of a release to attach release artifacts."
required: False
next_workflow:
description: "The workflow to trigger next."
required: False
next_workflow_payload:
description: "JSON input parameters to send to the next workflow."
required: False
default: "{}"
jobs: jobs:
build_and_test: build_and_test:
@ -57,126 +40,35 @@ jobs:
name: Build and test ${{ matrix.os_name }} ${{ matrix.build_type }} ${{ matrix.lib_type }} name: Build and test ${{ matrix.os_name }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: "10.10"
GYP_DEFINES: "target_arch=x64 libpackager_type=${{ matrix.lib_type }}_library"
DEPOT_TOOLS_WIN_TOOLCHAIN: "0"
GYP_MSVS_VERSION: "2019"
GYP_MSVS_OVERRIDE_PATH: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise"
steps: steps:
- name: Compute ref
# We could be building from a workflow dispatch (manual run or triggered
# by another workflow), or from a pull request. Subsequent steps can
# refer to $TARGET_REF to determine the correct ref in all cases.
run: |
echo "TARGET_REF=${{ github.event.inputs.ref || github.ref }}" >> $GITHUB_ENV
- name: Configure git to preserve line endings - name: Configure git to preserve line endings
# Fix issues with CRLF in test outputs on Windows by explicitly setting # Otherwise, tests fail on Windows because "golden" test outputs will not
# this core.autocrlf config. Without this, tests will later fail # have the correct line endings.
# because the "golden" test outputs in the source code will not have run: git config --global core.autocrlf false
# the correct line endings.
run: |
git config --global core.autocrlf false
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
path: src path: src
ref: ${{ env.TARGET_REF }} ref: ${{ github.event.inputs.ref || github.ref }}
- name: Install depot tools - name: Build docs (Linux only)
# NOTE: can't use actions/checkout here because this is not hosted on if: runner.os == 'Linux'
# GitHub. uses: ./src/.github/workflows/custom-actions/build-docs
run: |
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "${GITHUB_WORKSPACE}/depot_tools" >> $GITHUB_PATH
- name: Set up Python - name: Build Packager
uses: actions/setup-python@v2 uses: ./src/.github/workflows/custom-actions/build-packager
with: with:
python-version: 2.7 os_name: ${{ matrix.os_name }}
lib_type: ${{ matrix.lib_type }}
build_type: ${{ matrix.build_type }}
build_type_suffix: ${{ matrix.build_type_suffix }}
exe_ext: ${{ matrix.exe_ext }}
- name: Install macOS SDK 10.3 (macOS only) - name: Test Packager
if: matrix.os_name == 'osx' uses: ./src/.github/workflows/custom-actions/test-packager
# NOTE: macOS 11 doesn't work with our (old) version of Chromium build,
# and the latest Chromium build doesn't work with Packager's build
# system. To work around this, we need an older SDK version, and to
# get that, we need an older XCode version. XCode 10.3 has SDK 10.14,
# which works.
uses: maxim-lobanov/setup-xcode@v1
with: with:
xcode-version: 10.3 lib_type: ${{ matrix.lib_type }}
build_type: ${{ matrix.build_type }}
- name: Configure gclient build_type_suffix: ${{ matrix.build_type_suffix }}
run: | exe_ext: ${{ matrix.exe_ext }}
depot_tools/gclient config https://github.com/google/shaka-packager.git --name=src --unmanaged
- name: Sync gclient
run: |
depot_tools/gclient sync
- name: Build
run: |
depot_tools/ninja -C src/out/${{ matrix.build_type }}${{ matrix.build_type_suffix }}
- name: Test
shell: bash
run: |
# NOTE: Some of these tests must be run from the "src" directory.
cd src
if [[ '${{ matrix.os_name }}' == 'osx' ]]; then
export DYLD_FALLBACK_LIBRARY_PATH=out/${{ matrix.build_type }}${{ matrix.build_type_suffix }}
fi
set -x # So we can see what commands/tests are being executed
for i in out/${{ matrix.build_type }}${{ matrix.build_type_suffix }}/*test${{ matrix.exe_ext }}; do "$i" || exit 1; done
python out/${{ matrix.build_type }}${{ matrix.build_type_suffix }}/packager_test.py -v --libpackager_type=${{ matrix.lib_type }}_library
- name: Prepare artifacts
if: matrix.build_type == 'Release' && matrix.lib_type == 'static'
shell: bash
run: |
mkdir artifacts
mv \
src/out/Release${{ matrix.build_type_suffix }}/packager${{ matrix.exe_ext }} \
artifacts/packager-${{ matrix.os_name }}${{ matrix.exe_ext }}
mv \
src/out/Release${{ matrix.build_type_suffix }}/mpd_generator${{ matrix.exe_ext }} \
artifacts/mpd_generator-${{ matrix.os_name }}${{ matrix.exe_ext }}
if [[ '${{ matrix.os_name }}' == 'win' ]]; then
(
cd src/out/Release${{ matrix.build_type_suffix }}
7z a ../../../artifacts/pssh-box-${{ matrix.os_name }}.py.zip \
pyproto pssh-box.py
)
else
tar -czf artifacts/pssh-box-${{ matrix.os_name }}.py.tar.gz \
-C src/out/Release${{ matrix.build_type_suffix }} \
pyproto pssh-box.py
fi
- name: Attach artifacts to release
if: matrix.build_type == 'Release' && matrix.lib_type == 'static' && github.event.inputs.release_id
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }}
with:
release_id: ${{ github.event.inputs.release_id }}
assets_path: artifacts
launch_next_workflow:
name: Launch next workflow
if: github.event_name == 'workflow_dispatch' && github.event.inputs.next_workflow
needs: build_and_test
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }}
steps:
- name: Launch next workflow
run: |
echo '${{ github.event.inputs.next_workflow_payload }}' | \
gh workflow \
-R '${{ github.repository }}' \
run '${{ github.event.inputs.next_workflow }}' \
--json

View File

@ -0,0 +1,46 @@
name: Build Shaka Packager Docs
description: |
A reusable action to build Shaka Packager docs.
Leaves docs output in the "gh-pages" folder.
Only runs in Linux due to the dependency on doxygen, which we install with
apt.
runs:
using: composite
steps:
- name: Install dependencies
shell: bash
run: |
echo "::group::Install dependencies"
sudo apt install -y doxygen
python3 -m pip install \
sphinxcontrib.plantuml \
recommonmark \
cloud_sptheme \
breathe
echo "::endgroup::"
- name: Generate docs
shell: bash
run: |
echo "::group::Prepare output folders"
mkdir -p gh-pages
cd src
mkdir -p out
echo "::endgroup::"
echo "::group::Build Doxygen docs"
# Doxygen must run before Sphinx. Sphinx will refer to
# Doxygen-generated output when it builds its own docs.
doxygen docs/Doxyfile
echo "::endgroup::"
echo "::group::Build Sphinx docs"
# Now build the Sphinx-based docs.
make -C docs/ html
echo "::endgroup::"
echo "::group::Move ouputs"
# Now move the generated outputs.
cp -a out/sphinx/html ../gh-pages/html
cp -a out/doxygen/html ../gh-pages/docs
cp docs/index.html ../gh-pages/index.html
echo "::endgroup::"

View File

@ -0,0 +1,109 @@
name: Build Shaka Packager
description: |
A reusable action to build Shaka Packager.
Leaves build artifacts in the "artifacts" folder.
inputs:
os_name:
description: The name of the OS (one word). Appended to artifact filenames.
required: true
lib_type:
description: A library type, either "static" or "shared".
required: true
build_type:
description: A build type, either "Debug" or "Release".
required: true
build_type_suffix:
description: A suffix to append to the build type in the output path.
required: false
default: ""
exe_ext:
description: The extension on executable files.
required: false
default: ""
runs:
using: composite
steps:
- name: Select Xcode 10.3 and SDK 10.14 (macOS only)
# NOTE: macOS 11 doesn't work with our (old) version of Chromium build,
# and the latest Chromium build doesn't work with Packager's build
# system. To work around this, we need an older SDK version, and to
# get that, we need an older XCode version. XCode 10.3 has SDK 10.14,
# which works.
shell: bash
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
echo "::group::Select Xcode 10.3"
sudo xcode-select -s /Applications/Xcode_10.3.app/Contents/Developer
echo "::endgroup::"
fi
- name: Install depot tools
shell: bash
run: |
echo "::group::Install depot_tools"
git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
echo "${GITHUB_WORKSPACE}/depot_tools" >> $GITHUB_PATH
echo "::endgroup::"
- name: Configure gclient
shell: bash
run: |
echo "::group::Configure gclient"
gclient config https://github.com/google/shaka-packager.git --name=src --unmanaged
echo "::endgroup::"
- name: Sync gclient
env:
MACOSX_DEPLOYMENT_TARGET: "10.10"
GYP_DEFINES: "target_arch=x64 libpackager_type=${{ inputs.lib_type }}_library"
DEPOT_TOOLS_WIN_TOOLCHAIN: "0"
GYP_MSVS_VERSION: "2019"
GYP_MSVS_OVERRIDE_PATH: "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise"
shell: bash
run: |
echo "::group::Sync gclient"
gclient sync
echo "::endgroup::"
- name: Build
shell: bash
run: |
echo "::group::Build"
ninja -C src/out/${{ inputs.build_type }}${{ inputs.build_type_suffix }}
echo "::endgroup::"
- name: Prepare artifacts (static release only)
shell: bash
run: |
BUILD_CONFIG="${{ inputs.build_type }}-${{ inputs.lib_type }}"
if [[ "$BUILD_CONFIG" != "Release-static" ]]; then
echo "Skipping artifacts for $BUILD_CONFIG."
exit 0
fi
echo "::group::Prepare artifacts folder"
mkdir artifacts
ARTIFACTS="$GITHUB_WORKSPACE/artifacts"
cd src/out/Release${{ inputs.build_type_suffix }}
echo "::endgroup::"
echo "::group::Copy packager"
cp packager${{ inputs.exe_ext }} \
$ARTIFACTS/packager-${{ inputs.os_name }}${{ inputs.exe_ext }}
echo "::endgroup::"
echo "::group::Copy mpd_generator"
cp mpd_generator${{ inputs.exe_ext }} \
$ARTIFACTS/mpd_generator-${{ inputs.os_name }}${{ inputs.exe_ext }}
echo "::endgroup::"
if [[ '${{ runner.os }}' == 'Windows' ]]; then
echo "::group::Zip pssh-box"
7z a $ARTIFACTS/pssh-box-${{ inputs.os_name }}.py.zip \
pyproto pssh-box.py
echo "::endgroup::"
else
echo "::group::Tar pssh-box"
tar -czf $ARTIFACTS/pssh-box-${{ inputs.os_name }}.py.tar.gz \
pyproto pssh-box.py
echo "::endgroup::"
fi

View File

@ -0,0 +1,45 @@
name: Test Shaka Packager
description: |
A reusable action to test Shaka Packager.
Should be run after building Shaka Packager.
inputs:
lib_type:
description: A library type, either "static" or "shared".
required: true
build_type:
description: A build type, either "Debug" or "Release".
required: true
build_type_suffix:
description: A suffix to append to the build type in the output path.
required: false
default: ""
exe_ext:
description: The extension on executable files.
required: false
default: ""
runs:
using: composite
steps:
- name: Test
shell: bash
run: |
echo "::group::Prepare test environment"
# NOTE: Some of these tests must be run from the "src" directory.
cd src/
OUTDIR=out/${{ inputs.build_type }}${{ inputs.build_type_suffix }}
if [[ '${{ runner.os }}' == 'macOS' ]]; then
export DYLD_FALLBACK_LIBRARY_PATH=$OUTDIR
fi
echo "::endgroup::"
for i in $OUTDIR/*test${{ inputs.exe_ext }}; do
echo "::group::Test $i"
"$i" || exit 1
echo "::endgroup::"
done
echo "::group::Test $OUTDIR/packager_test.py"
python3 $OUTDIR/packager_test.py \
-v --libpackager_type=${{ inputs.lib_type }}_library
echo "::endgroup::"

View File

@ -11,7 +11,7 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
ref: ref:
description: "The tag to release to NPM." description: "The tag to release to Docker Hub."
required: True required: True
jobs: jobs:

View File

@ -1,86 +0,0 @@
name: Draft GitHub Release
# Runs when a new tag is created that looks like a version number.
#
# Creates a draft release on GitHub with the latest release notes, then chains
# to the build_and_test workflow and the publish_github_release workflow.
#
# Collectively, this will build and tests on all OSes, attach release artifacts
# to the release, and fully publish the release.
#
# Publishing the release then triggers additional workflows for NPM, Docker
# Hub, and GitHub Pages.
#
# Can also be run manually for debugging purposes.
on:
push:
tags:
- "v*.*"
# For manual debugging:
workflow_dispatch:
inputs:
tag:
description: "An existing tag to release."
required: True
jobs:
draft_release:
name: Draft GitHub release
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: src
- name: Compute ref
# We could be building from a workflow dispatch (manual run)
# or from a pushed tag. If triggered from a pushed tag, we would like
# to strip refs/tags/ off of the incoming ref and just use the tag
# name. Subsequent steps can refer to $TARGET_REF to determine the
# correct ref in all cases.
run: |
# Strip refs/tags/ from the input to get the tag name.
echo "TARGET_REF=${{ github.event.inputs.tag || github.ref }}" | \
sed -e 's@refs/tags/@@' >> $GITHUB_ENV
- name: Extract release notes
run: |
cd src
packager/tools/extract_from_changelog.py --release_notes \
| tee ../RELEASE_NOTES.md
# This check prevents releases without appropriate changelog updates.
VERSION=$(packager/tools/extract_from_changelog.py --version)
if [[ "$VERSION" != "$TARGET_REF" ]]; then
echo ""
echo ""
echo "***** ***** *****"
echo ""
echo "Version mismatch!"
echo "Workflow is targetting $TARGET_REF,"
echo "but CHANGELOG.md contains $VERSION!"
exit 1
fi
- name: Draft release
id: draft_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }}
with:
tag_name: ${{ env.TARGET_REF }}
release_name: ${{ env.TARGET_REF }}
body_path: RELEASE_NOTES.md
draft: true
- name: Start build and test, then publish
run: |
cd src
gh workflow run build_and_test.yaml \
-f 'ref=${{ env.TARGET_REF }}' \
-f 'release_id=${{ steps.draft_release.outputs.id }}' \
-f 'next_workflow=publish_github_release.yaml' \
-f 'next_workflow_payload={ "release_id": "${{ steps.draft_release.outputs.id }}" }'
echo "Triggered build_and_test workflow for release ID ${{ steps.draft_release.outputs.id }}."
env:
GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }}

171
.github/workflows/github_release.yaml vendored Normal file
View File

@ -0,0 +1,171 @@
name: GitHub Release
# Runs when a new tag is created that looks like a version number.
#
# 1. Creates a draft release on GitHub with the latest release notes
# 2. On all combinations of OS, build type, and library type:
# a. builds Packager
# b. builds the docs
# c. runs all tests
# d. attaches build artifacts to the release
# 3. Fully publishes the release on GitHub
#
# Publishing the release then triggers additional workflows for NPM, Docker
# Hub, and GitHub Pages.
#
# Can also be run manually for debugging purposes.
on:
push:
tags:
- "v*.*"
# For manual debugging:
workflow_dispatch:
inputs:
tag:
description: "An existing tag to release."
required: True
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.compute_tag.outputs.tag }}
steps:
- name: Compute tag
id: compute_tag
# We could be building from a workflow dispatch (manual run)
# or from a pushed tag. If triggered from a pushed tag, we would like
# to strip refs/tags/ off of the incoming ref and just use the tag
# name. Subsequent jobs can refer to the "tag" output of this job to
# determine the correct tag name in all cases.
run: |
# Strip refs/tags/ from the input to get the tag name, then store
# that in output.
echo "::set-output name=tag::${{ github.event.inputs.tag || github.ref }}" \
| sed -e 's@refs/tags/@@'
draft_release:
name: Create GitHub release
needs: setup
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.draft_release.outputs.id }}
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
path: src
ref: ${{ needs.setup.outputs.tag }}
- name: Check changelog version
# This check prevents releases without appropriate changelog updates.
run: |
cd src
VERSION=$(packager/tools/extract_from_changelog.py --version)
if [[ "$VERSION" != "${{ needs.setup.outputs.tag }}" ]]; then
echo ""
echo ""
echo "***** ***** *****"
echo ""
echo "Version mismatch!"
echo "Workflow is targetting ${{ needs.setup.outputs.tag }},"
echo "but CHANGELOG.md contains $VERSION!"
exit 1
fi
- name: Extract release notes
run: |
cd src
packager/tools/extract_from_changelog.py --release_notes \
| tee ../RELEASE_NOTES.md
- name: Draft release
id: draft_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }}
with:
tag_name: ${{ needs.setup.outputs.tag }}
release_name: ${{ needs.setup.outputs.tag }}
body_path: RELEASE_NOTES.md
draft: true
build_and_test:
needs: [setup, draft_release]
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
build_type: ["Debug", "Release"]
lib_type: ["static", "shared"]
include:
- os: ubuntu-latest
os_name: linux
exe_ext: ""
build_type_suffix: ""
- os: macos-latest
os_name: osx
exe_ext: ""
build_type_suffix: ""
- os: windows-latest
os_name: win
exe_ext: ".exe"
# 64-bit outputs on Windows go to a different folder name.
build_type_suffix: "_x64"
name: Build and test ${{ matrix.os_name }} ${{ matrix.build_type }} ${{ matrix.lib_type }}
runs-on: ${{ matrix.os }}
steps:
- name: Configure git to preserve line endings
# Otherwise, tests fail on Windows because "golden" test outputs will not
# have the correct line endings.
run: git config --global core.autocrlf false
- name: Checkout code
uses: actions/checkout@v2
with:
path: src
ref: ${{ needs.setup.outputs.tag }}
- name: Build docs (Linux only)
if: runner.os == 'Linux'
uses: ./src/.github/workflows/custom-actions/build-docs
- name: Build Packager
uses: ./src/.github/workflows/custom-actions/build-packager
with:
os_name: ${{ matrix.os_name }}
lib_type: ${{ matrix.lib_type }}
build_type: ${{ matrix.build_type }}
build_type_suffix: ${{ matrix.build_type_suffix }}
exe_ext: ${{ matrix.exe_ext }}
- name: Test Packager
uses: ./src/.github/workflows/custom-actions/test-packager
with:
lib_type: ${{ matrix.lib_type }}
build_type: ${{ matrix.build_type }}
build_type_suffix: ${{ matrix.build_type_suffix }}
exe_ext: ${{ matrix.exe_ext }}
- name: Attach artifacts to release
if: matrix.build_type == 'Release' && matrix.lib_type == 'static'
uses: dwenegar/upload-release-assets@v1
env:
GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }}
with:
release_id: ${{ needs.draft_release.outputs.release_id }}
assets_path: artifacts
publish_release:
name: Publish GitHub release
needs: [draft_release, build_and_test]
runs-on: ubuntu-latest
steps:
- name: Publish release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }}
with:
release_id: ${{ needs.draft_release.outputs.release_id }}

View File

@ -1,30 +0,0 @@
name: Publish GitHub Release
# Fully publishes a draft release on GitHub.
#
# Triggered in a chain initiated by the draft_github_release workflow, after
# the build_and_test workflow has finished attaching release artifacts to the
# draft release.
#
# Publishing the release then triggers additional workflows for NPM, Docker
# Hub, and GitHub Pages.
#
# Can also be run manually for debugging purposes.
on:
workflow_dispatch:
inputs:
release_id:
description: "The draft release ID."
required: True
jobs:
publish_release:
name: Publish GitHub release
runs-on: ubuntu-latest
steps:
- name: Publish release
uses: eregon/publish-release@v1
env:
GITHUB_TOKEN: ${{ secrets.SHAKA_BOT_TOKEN }}
with:
release_id: ${{ github.event.inputs.release_id }}

View File

@ -1,14 +1,11 @@
name: Update Docs name: Update Docs
# Runs when a new release is published on GitHub, or when a pull request is # Runs when a new release is published on GitHub.
# opened.
# #
# Pushes updated docs to GitHub Pages if triggered from a release workflow. # Pushes updated docs to GitHub Pages if triggered from a release workflow.
# #
# Can also be run manually for debugging purposes. # Can also be run manually for debugging purposes.
on: on:
pull_request:
types: [opened, synchronize, reopened]
release: release:
types: [published] types: [published]
# For manual debugging: # For manual debugging:
@ -25,52 +22,29 @@ jobs:
steps: steps:
- name: Compute ref - name: Compute ref
id: ref id: ref
# We could be building from a workflow dispatch (manual run), release # We could be building from a workflow dispatch (manual run) or from a
# event, or pull request. Subsequent steps can refer to $TARGET_REF to # release event. Subsequent steps can refer to the "ref" output of
# determine the correct ref in all cases. # this job to determine the correct ref in all cases.
run: | run: |
echo "TARGET_REF=${{ github.event.inputs.ref || github.event.release.tag_name || github.ref }}" >> $GITHUB_ENV echo "::set-output name=ref::${{ github.event.inputs.ref || github.event.release.tag_name }}"
- name: Checkout code - name: Checkout code
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
path: src path: src
ref: ${{ env.TARGET_REF }} ref: ${{ steps.ref.outputs.ref }}
- name: Set up Python - name: Set up Python
uses: actions/setup-python@v2 uses: actions/setup-python@v2
with: with:
python-version: 3.8 python-version: 3.8
- name: Install dependencies - name: Build docs
run: | uses: ./src/.github/workflows/custom-actions/build-docs
pip install wheel
pip install sphinxcontrib.plantuml
pip install recommonmark
pip install cloud_sptheme
pip install breathe
sudo apt-get install -y doxygen
- name: Generate docs - name: Deploy to gh-pages branch
run: |
mkdir gh-pages
cd src
mkdir out
# Doxygen must run before Sphinx. Sphinx will refer to
# Doxygen-generated output when it builds its own docs.
doxygen docs/Doxyfile
# Now build the Sphinx-based docs.
make -C docs/ html
# Now move the generated outputs.
mv out/sphinx/html ../gh-pages/html
mv out/doxygen/html ../gh-pages/docs
cp docs/index.html ../gh-pages/index.html
- name: Deploy to gh-pages branch (releases only)
# This is skipped when testing a PR
if: github.event_name != 'pull_request'
uses: peaceiris/actions-gh-pages@v3 uses: peaceiris/actions-gh-pages@v3
with: with:
github_token: ${{ secrets.SHAKA_BOT_TOKEN }} github_token: ${{ secrets.SHAKA_BOT_TOKEN }}
publish_dir: gh-pages publish_dir: gh-pages
full_commit_message: Generate docs for ${{ env.TARGET_REF }} full_commit_message: Generate docs for ${{ steps.ref.outputs.ref }}

View File

@ -26,9 +26,9 @@ class PackagerApp(object):
# Set this to empty for now in case GetCommandLine() is called before # Set this to empty for now in case GetCommandLine() is called before
# Package(). # Package().
self.packaging_command_line = '' self.packaging_command_line = ''
assert os.path.exists( assert os.path.exists(self.packager_binary), (
self.packager_binary), ('Please run from output directory, ' 'Please run from output directory, e.g. out/Debug/packager_test.py\n'
'e.g. out/Debug/packager_test.py') ' Missing: ' + self.packager_binary)
def _GetBinaryName(self, name): def _GetBinaryName(self, name):
if platform.system() == 'Windows': if platform.system() == 'Windows':