Update the GitHub Actions workflow to use modern actions. #47
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
--- | |
# Build of the RISC OS PRM-in-XML staging repository. | |
# | |
name: PRMinXML | |
# Controls when the action will run. Triggers the workflow on: | |
# * push on any branch. | |
on: | |
push: | |
branches: ["*"] | |
tags: ["v*"] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: write | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Build it | |
run: | | |
# PrinceXML (http://www.princexml.com/) requires a license to be used. | |
# If the documents produced contain no advertising, and are provided for | |
# no cost to anyone, and are published on a site that has no cost and has | |
# no advertising, and providing that a link is provided to the PrinceXML | |
# site, the non-commercial license can be used (even on a server). | |
# Consult https://www.princexml.com/purchase/license_faq/ for more details. | |
# | |
# These criteria are met by the builds we're creating here, and so we can | |
# use the non-commercial license. | |
sudo env PRINCEXML_I_HAVE_A_LICENSE=1 ./build.sh all | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: PRMinXML-Staging | |
path: output | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build-Logs | |
path: logs | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: ./output | |
# The release only triggers when the thing that was pushed was a tag starting with 'v' | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
#if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Download built documentation | |
uses: actions/download-artifact@v3 | |
with: | |
name: PRMinXML-Staging | |
- name: Get the version | |
id: get_version | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
- name: Build the zip archive from the documentation | |
run: | | |
cd PRMinXML-Staging | |
zip -9r ../PRMinXML-Staging-${{ steps.get_version.outputs.VERSION }}.zip * | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
prerelease: false | |
draft: true | |
artifacts: "PRMinXML-Staging-${{ steps.get_version.outputs.VERSION }}.zip,PRMinXML-Staging/prm/RISCOS_PRM_Staging.pdf" | |
artifactContentType: application/zip | |
publish: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
#if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v2 |