Skip to content

Commit 16d72a2

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.
1 parent 9a15e72 commit 16d72a2

File tree

1 file changed

+119
-0
lines changed

1 file changed

+119
-0
lines changed

.github/workflows/robuild.yaml

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

0 commit comments

Comments
 (0)