Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raw static url #1178

Closed
wants to merge 18 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy Jekyll site to Pages

on:
push:
branches: ["gh-pages", "rawStaticUrl"]

workflow_dispatch:

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

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
env:
PAGES_REPO_NWO: Dlurak/choosealicense.com
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0
with:
ruby-version: '3.1' # Not needed with a .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
cache-version: 0 # Increment this number if you need to re-download cached gems
- name: Setup Pages
id: pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
# Outputs to the './_site' directory by default
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"
env:
JEKYLL_ENV: production
- name: Copy licenses into ./_site
run: |
chmod +x script/build
./script/build
- name: Upload artifact
# Automatically uploads an artifact from the './_site' directory by default
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ assets/vendor/hint.css/src
/tmp
Gemfile.lock
.jekyll-metadata
raw
2 changes: 2 additions & 0 deletions _includes/sidebar.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<div class="sidebar">

<a href="#" data-clipboard-target="#license-text" data-proofer-ignore="true" class="js-clipboard-button button">Copy license text to clipboard</a>
<pre>https://choosealicense.com/raw/{{ page.spdx-id | downcase }}</pre>

{% unless page.spdx-id == 'LGPL-3.0' %}
<h3 id="suggest-this-license">Suggest this license</h3>
<div class="repository-suggestion">
Expand Down
8 changes: 8 additions & 0 deletions script/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
echo "copy licenses"

mkdir _site/raw -p

for file in _licenses/*.txt; do
echo "$file"
awk '/^---$/ {if (++count == 2) {p=1; next}} p' "$file" | tail -n +2 > "_site/raw/$(basename "$file" .txt)"
done