Skip to content

Commit 6c0a776

Browse files
committed
Add a GitHub workflow to build through the build service.
The workflow isn't very specialised - it has been copied from the template repository with just the names changed to allow it to build properly. However, as we're focusing on pull requests, the conditions have been updated so that it triggers on the pull request not just on the branch - this is important as otherwise it wouldn't trigger when we create a PR from a fork.
1 parent 9a15e72 commit 6c0a776

File tree

1 file changed

+118
-0
lines changed

1 file changed

+118
-0
lines changed

.github/workflows/robuild.yaml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
# RISC OS CI build through build.riscos.online
3+
#
4+
# To reuse this configuration with your own repository:
5+
#
6+
# - Create a .robuild.yaml to describe what should be built on RISC OS.
7+
# - `jobs.build.script` should be a list of commands to run on RISC OS
8+
# - `jobs.build.artifacts.path` should be the directory to zip.
9+
# - Create a VersionNum file if you wish to use the automated versioning
10+
# in the same style as the RISC OS sources. [optional]
11+
# - Update the 3rd step ('give the archive a versioned name') to give a
12+
# suitable name for the archive.
13+
# - Update the 4th step ('upload-artifacts') to include the same names.
14+
#
15+
# The 'release' job is triggered when a tag starting with a 'v' is created,
16+
# which will create a GitHub release for the repository with the name of the
17+
# version tag. The release will be a draft, and should be updated with
18+
# changes as you see fit.
19+
#
20+
21+
name: RISC OS
22+
23+
# Controls when the action will run. Triggers the workflow on:
24+
# * push on any branch.
25+
# * tag creation for tags beginning with a 'v'
26+
on:
27+
push:
28+
tags: ["v*"]
29+
# Pull request events happen on pull request state transitions, and also when the PR is created.
30+
pull_request:
31+
branches: ["*"]
32+
33+
jobs:
34+
build-riscos:
35+
# The type of runner that the job will run on
36+
runs-on: ubuntu-latest
37+
38+
outputs:
39+
version: ${{ steps.version.outputs.version }}
40+
leafname: ${{ steps.version.outputs.leafname }}
41+
42+
# Steps represent a sequence of tasks that will be executed as part of the job
43+
steps:
44+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
45+
- uses: actions/checkout@v2
46+
47+
- name: Obtain prerequisite build tool
48+
run: |
49+
# Fetch the build client
50+
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
51+
52+
- name: Build through build.riscos.online
53+
run: |
54+
# Zip up the source to send to robuild
55+
zip -q9r /tmp/source-archive.zip * .robuild.yaml
56+
# Send the archive file to build service (timeout of 60 seconds)
57+
./riscos-build-online -i /tmp/source-archive.zip -a off -t 60 -o /tmp/built
58+
59+
- name: Give the output a versioned name
60+
id: version
61+
run: |
62+
if [[ -f src/VersionNum ]] ; then
63+
version=$(sed '/MajorVersion / ! d ; s/.*MajorVersion *"\(.*\)"/\1/' src/VersionNum)
64+
else
65+
version=$(git rev-parse --short HEAD)
66+
fi
67+
echo "This is version: $version"
68+
leafname="WakeOnLAN-$version.zip"
69+
if [ -f /tmp/built,a91 ] ; then
70+
cp /tmp/built,a91 "WakeOnLAN-$version.zip"
71+
else
72+
echo "No archive was built?"
73+
exit 1
74+
fi
75+
echo "::set-output name=version::$version"
76+
echo "::set-output name=leafname::$leafname"
77+
78+
- uses: actions/upload-artifact@v2
79+
with:
80+
name: RISCOS-build
81+
path: ${{ steps.version.outputs.leafname }}
82+
# The artifact that is downloadable from the Actions is actually a zip of the artifacts
83+
# that we supply. So it will be a regular Zip file containing a RISC OS Zip file.
84+
85+
# The release only triggers when the thing that was pushed was a tag starting with 'v'
86+
release:
87+
needs: build-riscos
88+
runs-on: ubuntu-latest
89+
if: startsWith(github.ref, 'refs/tags/v')
90+
steps:
91+
- name: Download built binary
92+
uses: actions/download-artifact@v1
93+
with:
94+
name: RISCOS-build
95+
96+
- name: Create Release
97+
id: create_release
98+
uses: actions/create-release@v1
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
with:
102+
tag_name: ${{ github.ref }}
103+
release_name: Release ${{ needs.build-riscos.outputs.version }}
104+
draft: true
105+
prerelease: false
106+
107+
- name: Upload Release Asset
108+
id: upload-release-asset
109+
uses: actions/upload-release-asset@v1
110+
env:
111+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
112+
with:
113+
# This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`.
114+
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
115+
upload_url: ${{ steps.create_release.outputs.upload_url }}
116+
asset_path: RISCOS-build/${{ needs.build-riscos.outputs.leafname }}
117+
asset_name: ${{ needs.build-riscos.outputs.leafname }}
118+
asset_content_type: application/zip

0 commit comments

Comments
 (0)