Use GITHUB_OUTPUT envvar instead of set-output command as the latter is deprecated #680
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update API docs | |
on: | |
# Trigger on push to branches `master` and `3.5`. | |
push: | |
branches: [master, 3.5] | |
# Trigger on pull request events for PRs that have `master` as their target branch | |
pull_request: | |
branches: [master] | |
# Allow running the workflow manually | |
workflow_dispatch: | |
defaults: | |
run: | |
# GitHub Actions adds `errexit` and `pipefail` by default, but we add `xtrace` | |
# to improve debugging some of the longer scripts. | |
shell: /bin/bash -o errexit -o pipefail -o xtrace {0} | |
permissions: | |
contents: read | |
jobs: | |
main: | |
runs-on: ubuntu-20.04 | |
env: | |
# Used for stable dates in documentation examples. See #2070. | |
SOURCE_DATE_EPOCH: "1893456000" | |
steps: | |
# Create a cache invalidation key based on the current year + week. | |
# This way, packages will be checked for updates once every week. | |
- name: Get Date | |
id: get-date | |
run: echo "date=$(/bin/date -u "+%Y%W")" >> $GITHUB_OUTPUT | |
- name: Cache apt packages | |
id: cache-apt | |
uses: actions/cache@v2 | |
with: | |
path: /var/cache/apt/archives | |
# The trailing number serves as a version flag that can be incremented | |
# to invalidate the cache after changing the list of packages. | |
key: ${{ github.workflow }}-${{ runner.os }}-${{ steps.get-date.outputs.date }}-apt-3 | |
- name: Download apt packages | |
if: steps.cache-apt.outputs.cache-hit != 'true' | |
run: | | |
sudo apt-get update | |
sudo apt-get install --download-only -y --no-install-recommends \ | |
asciidoctor \ | |
cmake \ | |
dbus-x11 \ | |
gettext \ | |
gir1.2-gtk-3.0 \ | |
gir1.2-pango-1.0 \ | |
git \ | |
libdbus-1-dev \ | |
libgirepository1.0-dev \ | |
libnotify-bin \ | |
libpango1.0-dev \ | |
libstartup-notification0-dev \ | |
libx11-xcb-dev \ | |
libxcb-cursor-dev \ | |
libxcb-icccm4-dev \ | |
libxcb-keysyms1-dev \ | |
libxcb-randr0-dev \ | |
libxcb-shape0-dev \ | |
libxcb-util0-dev \ | |
libxcb-xfixes0-dev \ | |
libxcb-xinerama0-dev \ | |
libxcb-xkb-dev \ | |
libxcb-xrm-dev \ | |
libxcb-xtest0-dev \ | |
libxdg-basedir-dev \ | |
libxkbcommon-dev \ | |
libxkbcommon-x11-dev \ | |
xutils-dev \ | |
lua-discount \ | |
liblua5.3-dev \ | |
lua5.3 | |
- name: Install downloaded packages | |
run: | | |
sudo dpkg -i /var/cache/apt/archives/*.deb | |
- name: Cache luarocks | |
id: cache-luarocks | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/luarocks | |
key: ${{ github.workflow }}-${{ runner.os }}-luarocks-3.5.0 | |
- name: Install fresh Luarocks | |
if: steps.cache-luarocks.outputs.cache-hit != 'true' | |
run: | | |
wget -O /tmp/luarocks.tar.gz https://github.com/luarocks/luarocks/archive/v3.5.0.tar.gz | |
mkdir /tmp/luarocks | |
tar -xf /tmp/luarocks.tar.gz -C /tmp/luarocks --strip-components=1 | |
cd /tmp/luarocks | |
./configure | |
make build | |
sudo make install | |
- name: Install cached Luarocks | |
if: steps.cache-luarocks.outputs.cache-hit == 'true' | |
run: | | |
cd /tmp/luarocks | |
sudo make install | |
- name: Install rocks | |
run: | | |
sudo -H luarocks install lgi | |
sudo -H luarocks install ldoc | |
- uses: actions/checkout@v2 | |
- name: Build Awesome version string | |
run: | | |
# If this workflow is triggered by a pull request, we get a base branch. | |
# Otherwise, check if the current commit has a meaningful name. | |
if [ -n "${{ github.base_ref }}" ]; then | |
AWESOME_VERSION="${{ github.base_ref }}" | |
else | |
AWESOME_VERSION="$(git rev-parse --abbrev-ref HEAD)" | |
fi | |
AWESOME_VERSION="${AWESOME_VERSION}-g$(git rev-parse --short HEAD)" | |
if [ "${{ github.event_name }}" == "pull_request" && -n "${{ matrix.test_prev_commits }}" ]; then | |
AWESOME_VERSION="${AWESOME_VERSION}-PR${{ github.event.number }}" | |
elif [ "${{ github.event_name }}" == "pull_request" ]; then | |
AWESOME_VERSION="v9999-PR${{ github.event.number }}" | |
fi | |
echo "AWESOME_VERSION=${AWESOME_VERSION}" >> ${GITHUB_ENV} | |
- name: Create Build Environment | |
run: cmake -E make_directory -B "${{ github.workspace }}/build" | |
- name: Configure CMake | |
run: | | |
cmake -S ${{ github.workspace }} -B "${{ github.workspace}}/build" \ | |
-DAWESOME_VERSION=$AWESOME_VERSION \ | |
-DGENERATE_DOC=ON \ | |
-DGENERATE_MANPAGES=ON \ | |
-DDO_COVERAGE=OFF | |
- name: Build | |
run: cd "${{ github.workspace }}/build" && make | |
- name: Run apidoc script | |
env: | |
PR_NUMBER: ${{ github.event.number }} | |
APIDOC_TOKEN: ${{ secrets.AWESOME_ROBOT_TOKEN || github.token }} | |
GITHUB_COMPARE: ${{ github.event.compare }} | |
run: .github/scripts/apidoc.sh | |
# vim: filetype=yaml:expandtab:shiftwidth=2:tabstop=2 |