Add .github build directory. #2
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
--- | |
# RISC OS CI build through build.riscos.online | |
# | |
# | |
# The 'release' job is triggered when a tag starting with a 'v' is created, | |
# which will create a GitHub release for the repository with the name of the | |
# version tag. The release will be a draft, and should be updated with | |
# changes as you see fit. | |
# | |
name: RISC OS | |
# Controls when the action will run. Triggers the workflow on: | |
# * push on any branch. | |
# * tag creation for tags beginning with a 'v' | |
on: | |
push: | |
branches: ["*"] | |
tags: ["v*"] | |
# Pull request events happen on pull request state transitions, so we probably don't want this here. | |
#pull_request: | |
# branches: ["*"] | |
jobs: | |
build-riscos: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
leafname: ${{ steps.version.outputs.leafname }} | |
# 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 | |
# Step intended to be reused in CI pipelines. | |
- name: Obtain prerequisite build tool | |
run: | | |
# Fetch the build client | |
curl -s -L -o riscos-build-online https://github.com/gerph/robuild-client/releases/download/v0.05/riscos-build-online && chmod +x riscos-build-online | |
- name: Build through build.riscos.online | |
run: | | |
# Zip up the source to send to robuild | |
zip -q9r /tmp/source-archive.zip * .robuild.yaml | |
# Send the archive file to build service | |
./riscos-build-online -i /tmp/source-archive.zip -a off -t 60 -o /tmp/built | |
- name: Give the output a versioned name | |
id: version | |
run: | | |
if [[ -f VersionNum ]] ; then | |
version=$(sed '/MajorVersion / ! d ; s/.*MajorVersion *"\(.*\)"/\1/' VersionNum) | |
else | |
version=$(git rev-parse --short HEAD) | |
fi | |
echo "This is version: $version" | |
leafname="BasToTxt-$version.zip" | |
if [ -f /tmp/built,a91 ] ; then | |
cp /tmp/built,a91 "BasToTxt-$version.zip" | |
else | |
echo "No archive was built?" | |
exit 1 | |
fi | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "leafname=$leafname" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: RISCOS-build | |
path: ${{ steps.version.outputs.leafname }} | |
# The artifact that is downloadable from the Actions is actually a zip of the artifacts | |
# that we supply. So it will be a regular Zip file containing a RISC OS Zip file. | |
build-ubuntu: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.version }} | |
leafname: ${{ steps.version.outputs.leafname }} | |
# 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@v2 | |
- name: Build bastotxt | |
run: | | |
cd posix | |
make | |
cd .. | |
- name: Rename the file we got | |
id: version | |
run: | | |
if [[ -f VersionNum ]] ; then | |
version=$(sed '/MajorVersion / ! d ; s/.*MajorVersion *"\(.*\)"/\1/' VersionNum) | |
else | |
version=$(git rev-parse --short HEAD) | |
fi | |
echo "This is version: $version" | |
leafname="bastotxt-ubuntu-$version" | |
if [ -f posix/bastotxt ] ; then | |
cp posix/bastotxt "bastotxt-ubuntu-$version" | |
else | |
echo "No binary was built?" | |
exit 1 | |
fi | |
echo "version=$version" >> $GITHUB_OUTPUT | |
echo "leafname=$leafname" >> $GITHUB_OUTPUT | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Ubuntu-build | |
path: ${{ steps.version.outputs.leafname }} | |
# The release only triggers when the thing that was pushed was a tag starting with 'v' | |
release: | |
needs: | |
- build-riscos | |
- build-ubuntu | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
permissions: | |
contents: write | |
steps: | |
- name: Download built RISC OS binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: RISCOS-build | |
- name: Download built Ubuntu binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: Ubuntu-build | |
- name: Create Release | |
id: create_release | |
uses: ncipollo/release-action@v1 | |
with: | |
prerelease: false | |
draft: true | |
artifacts: "${{ needs.build-riscos.outputs.leafname }},${{ needs.build-ubuntu.outputs.leafname }}" | |
artifactContentType: application/octet-stream |