Skip to content

Commit

Permalink
Merge pull request #22 from lesserwhirls/upgrades
Browse files Browse the repository at this point in the history
Upgrades
  • Loading branch information
lesserwhirls authored Jan 28, 2025
2 parents e54150f + 6d882e8 commit 8ab0021
Show file tree
Hide file tree
Showing 14 changed files with 59 additions and 554 deletions.
62 changes: 37 additions & 25 deletions .github/workflows/jekyll.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,46 @@ on:
branches:
- main

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
name: Build the default unidata-jekyll-theme site
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: ruby/setup-ruby@v1
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@4a9ddd6f338a97768b8006bf671dfbad383215f4
with:
ruby-version: '2.7'
ruby-version: '3.4.1'
bundler-cache: true
- name: Install jekyll
run: |
gem install bundler
bundle install
- name: Build the default site
run: |
bundle exec jekyll clean
bundle exec jekyll build
- if: ${{ success() && github.event_name == 'pull_request' }}
name: Upload a preview of the rendered html
uses: actions/upload-artifact@v2
with:
name: default_site_preview_${{ github.sha }}
path: _site
- if: ${{ success() && github.event_name == 'push' }}
name: Publish Documentation to Github Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./_site
force_orphan: true
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5
- name: Build the default site with Jekyll
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Upload a preview of the rendered html
uses: actions/upload-pages-artifact@v3
# deploy on push
deploy:
if: ${{ github.event_name == 'push' }}
needs: build
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
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,3 @@ vendor/
*.gem
.jekyll-cache
Gemfile.lock

# gradle stuff
.gradle/
build/
87 changes: 0 additions & 87 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,47 +113,6 @@ The first time you run this command, the nexus gem will ask you for the url of t
The url you want to use is `https://artifacts.unidata.ucar.edu/repository/gem-unidata`.
These are cached and reused in the future.

Since the theme is consumed by Java projects using `JRuby`, we also need to publish the gem files as Maven artifacts.
This is done using `gradle`.
The gradle build is configured to read the version of each gem from that gems' associated `gemspec` file.
This means there are no configuration files to update when publishing the Maven artifact of the gem file.
All that is needed is to run the appropriate task using gradle.

If a new release of the `unidata-jekyll-plugins` artifact is needed, publish the corresponding maven artifact using:

~~~sh
./gradlew clean publishPlugin
~~~

If a new release of the `unidata-jekyll-theme` artifact is needed, use:

~~~sh
./gradlew clean publishTheme
~~~

If both artifacts have a new release, you can publish them both with one command:

~~~sh
./gradlew clean publish
~~~

Note that the gem files must be created using Ruby before publishing them as Maven artifacts.

The full steps needed to publish everything will look something like the following:

~~~sh
rm .\unidata-jekyll-plugins-<old-version>.gem
rm .\unidata-jekyll-theme-<old-version>.gem

gem build .\unidata-jekyll-plugins.gemspec
gem nexus .\unidata-jekyll-plugins-<new-version>.gem

gem build .\unidata-jekyll-theme.gemspec
gem nexus .\unidata-jekyll-theme-<new-version>.gem

./gradlew clean publish
~~~

## Using the gem-based theme in your own documentation

### Ruby
Expand All @@ -168,52 +127,6 @@ Once you have done this, you can generally follow the jekyll documentation regar
You will also need to make sure you include the `unidata-jekyll-plugin` gem.
As this theme progresses, we will add more details about Unidata specific extensions to the theme, but for now, consider this a work in progress :-)

### Java

Unidata maintains a [gradle plugin](https://github.com/Unidata/unidata-jekyll-gradle) that utilizes JRuby to run Jekyll to build Jekyll sites using the Unidata theme maintained in this repository.
While useful for Java based projects, it is also useful to those want to build documentation sets without installing the full Ruby stack.
The only requirement for using the gradle plugin is Java version 8 or greater.

The gradle build in this project uses the `unidata-jekyll-gradle` plugin.
However, if you would like to use the plugin to build and serve the files in this repo, you must make a few edits prior to running `./gradlew buildJekyllSite` or `./gradlew serveJekyllSite`.
1. edit `_config.yml` and comment out the line setting the theme (that is, add a `#` to the beginning of the line `theme: unidata-jekyll-theme`)
1. move the file `Gemfile` to a temporary directory.

Note that both of these changes **must** be undone before making pull requests with changes or publishing artifacts.
Once changed, simply execute the following from the command line at the top level of the github repo:

~~~bash
./gradlew serveJekyllSite
~~~

Jekyll will start:

~~~posh
> Task :serveJekyllSite
Configuration file: C:\Users\sarms\dev\unidata\repos\unidata-jekyll-theme/_config.yml
Source: C:\Users\sarms\dev\unidata\repos\unidata-jekyll-theme
Destination: C:/Users/sarms/dev/unidata/repos/unidata-jekyll-theme/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 16.19 seconds.
Please add the following to your Gemfile to avoid polling for changes:
gem 'wdm', '>= 0.1.0' if Gem.win_platform?
Auto-regeneration: enabled for 'C:\Users\sarms\dev\unidata\repos\unidata-jekyll-theme'
Server address: http://127.0.0.1:4000
Server running... press ctrl-c to stop.
<========-----> 66% EXECUTING [1m 5s]
> :serveJekyllSite
~~~

Note the `Server address` in the output - this is where you should point your browser to see a live view of the documentation.
Each time a documentation file is edited and saved, Jekyll will regenerate the html file:

~~~bash
Regenerating: 1 file(s) changed at 2021-04-01 13:43:40
pages/unidata/DocGuide.md
...done in 8.897 seconds.
~~~

## Potentially useful utilities

The `utilities/` directory contains some potentially useful scripts from the upstream repository for generating tags and pdf docs.
Expand Down
4 changes: 0 additions & 4 deletions _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,10 @@ port: 4000
# these are the files and directories that jekyll will exclude from the build
exclude:
- build/
- gradle/
- utils/
- .idea/
- .gradle/
- .git/
- .vscode/
- "*.gradle"
- "gradlew*"
- "*.gem"
- "*.gemspec"
- "Gemfile.*"
Expand Down
29 changes: 18 additions & 11 deletions _includes/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,28 @@
<link rel="stylesheet" href="{{ "assets/css/customstyles.css" }}">
<link rel="stylesheet" href="{{ "assets/css/theme-unidata.css" }}">

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"></script>
<script
src="https://code.jquery.com/jquery-3.7.1.min.js"
integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo="
crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js"
integrity="sha512-3j3VU6WC5rPQB4Ld1jnLV7Kd5xr+cq9avvhwqzbH/taCRNURoeEpoPBK9pDyeukwSxwRPJ8fDgvYXd6SkaZ2TA=="
crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script src="{{ "assets/js/jquery.navgoco.min.js" }}"></script>


<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/2.0.0/anchor.min.js"></script>
<script
src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/anchor-js/4.3.1/anchor.min.js"
integrity="sha512-zPB79j2C+3sFS9zcA3vg/z6bVKzJVEyu9pY5w89akQRys76zpAT2t6S3wZKla3QQ14O5l/Yt0RUQ/DHXx82Y5g=="
crossorigin="anonymous"
referrerpolicy="no-referrer"></script>
<script src="{{ "assets/js/toc.js" }}"></script>
<script src="{{ "assets/js/customscripts.js" }}"></script>

<link rel="shortcut icon" href="{{ "assets/images/favicon.ico" }}">

<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
4 changes: 2 additions & 2 deletions assets/js/customscripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function updateVersionMenu() {
async: true
});

request.success(function(data) {
request.done(function(data) {
// Remove menu placeholder
$("li#remove").remove();

Expand All @@ -77,7 +77,7 @@ function updateVersionMenu() {
});
});

request.error(function(data) {
request.fail(function(data) {
// Remove menu placeholder
$("li#remove").remove();
// Insert an error indicator. Maybe this should link somewhere?
Expand Down
124 changes: 0 additions & 124 deletions build.gradle

This file was deleted.

Binary file removed gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 0 additions & 5 deletions gradle/wrapper/gradle-wrapper.properties

This file was deleted.

Loading

0 comments on commit 8ab0021

Please sign in to comment.