Skip to content

Commit

Permalink
Build a weekly webpage of CCS Customer Unique Reference Numbers.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonwo committed Oct 5, 2024
0 parents commit fc9db70
Show file tree
Hide file tree
Showing 6 changed files with 222 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Pages
on:
push:
schedule:
- cron: '0 3 * * 0' # Runs every Sunday at 3am

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Setup hq
run: |
curl -sL https://github.com/ludovicianul/hq/releases/download/hq-1.3.2/hq_linux_amd64_1.3.2.tar.gz --output - | tar -xzv
- run: |
export HQ=$(realpath ./hq)
make
- uses: actions/[email protected]
with:
path: _site

deploy:
needs: build
if: ${{ github.ref == 'refs/heads/main' }}

permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source

environment:
name: Github Pages
url: ${{ steps.deployment.outputs.page_url }}

runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
_data
_site
6 changes: 6 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# frozen_string_literal: true

source "https://rubygems.org"

gem "jekyll"
gem "roo"
89 changes: 89 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
GEM
remote: https://rubygems.org/
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
bigdecimal (3.1.8)
colorator (1.1.0)
concurrent-ruby (1.3.4)
em-websocket (0.5.3)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0)
eventmachine (1.2.7)
ffi (1.17.0)
forwardable-extended (2.6.0)
google-protobuf (4.28.2-arm64-darwin)
bigdecimal
rake (>= 13)
google-protobuf (4.28.2-x86_64-linux)
bigdecimal
rake (>= 13)
http_parser.rb (0.8.0)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
jekyll (4.3.4)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 1.0)
jekyll-sass-converter (>= 2.0, < 4.0)
jekyll-watch (~> 2.0)
kramdown (~> 2.3, >= 2.3.1)
kramdown-parser-gfm (~> 1.0)
liquid (~> 4.0)
mercenary (>= 0.3.6, < 0.5)
pathutil (~> 0.9)
rouge (>= 3.0, < 5.0)
safe_yaml (~> 1.0)
terminal-table (>= 1.8, < 4.0)
webrick (~> 1.7)
jekyll-sass-converter (3.0.0)
sass-embedded (~> 1.54)
jekyll-watch (2.2.1)
listen (~> 3.0)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (4.0.4)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
mercenary (0.4.0)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
pathutil (0.16.2)
forwardable-extended (~> 2.6)
public_suffix (6.0.1)
racc (1.8.1)
rake (13.2.1)
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.3.8)
roo (2.10.1)
nokogiri (~> 1)
rubyzip (>= 1.3.0, < 3.0.0)
rouge (4.4.0)
rubyzip (2.3.2)
safe_yaml (1.0.5)
sass-embedded (1.79.4)
google-protobuf (~> 4.27)
rake (>= 13)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
unicode-display_width (2.6.0)
webrick (1.8.2)

PLATFORMS
arm64-darwin-22
x86_64-linux

DEPENDENCIES
jekyll
roo

BUNDLED WITH
2.4.1
15 changes: 15 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
HQ ?= hq

_site/: _data/urns.csv
bundle exec jekyll build --safe

_data/:
mkdir -p $@

_data/urns.ods: _data/
curl --output - 'https://www.gov.uk/guidance/current-crown-commercial-service-suppliers-what-you-need-to-know#customer-unique-reference-number-urn-list' | \
${HQ} -a href 'a[href*="CCS_Customer_URN_List"][href$$=".ods"]' | \
xargs curl --output '$@'

_data/urns.csv: _data/urns.ods
bundle exec ruby -rroo -e 'puts Roo::Spreadsheet.open("$^").sheet(1).to_csv' > $@
67 changes: 67 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
---
title: Crown Commercial Service Customer Unique Reference Numbers (URNs)
---
<!doctype html>
<html lang="en">

<head>
<meta charset="utf-8">
<title>{{ page.title }}</title>
<style type="text/css">
body {
max-width: 80%;
margin: 0 auto;
font-family: sans-serif;
}

table {
border-collapse: collapse;
color: #333;
border-radius: 10px;
box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
}

table th {
background-color: #ff9800;
color: #fff;
padding: 10px;
border-top: 1px solid #fff;
border-bottom: 1px solid #ccc;
}

table tr:nth-child(even) td {
background-color: #f2f2f2;
}

table tr:hover td {
background-color: #ffedcc;
}

table td {
background-color: #fff;
padding: 10px;
border-bottom: 1px solid #ccc;
}
</style>
</head>

<body>
<h1>{{ page.title }}</h1>
<table>
{% for row in site.data.urns -%}
{%- if forloop.first -%}
<tr>
{%- for pair in row -%}
<th>{{ pair[0] }}</th>
{%- endfor -%}
</tr>
{%- endif -%}

{%- tablerow pair in row -%}
{{ pair[1] }}
{%- endtablerow -%}
{%- endfor -%}
</table>
</body>

</html>

0 comments on commit fc9db70

Please sign in to comment.