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

Fix cicd #24

Merged
merged 13 commits into from
Dec 19, 2022
Merged
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
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ If applicable, add screenshots to help explain your problem.
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Last upstream Slate commit (run `git log --author="Robert Lord" | head -n 1`):**
**Last upstream Slate commit (run `git log --author="\(Robert Lord\)\|\(Matthew Peveler\)\|\(Mike Ralphson\)" | head -n 1`):**
Put the commit hash here
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
target-branch: dev
versioning-strategy: increase-if-necessary
12 changes: 9 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7]
ruby-version: [2.6, 2.7, '3.0', 3.1]

steps:
- uses: actions/checkout@v2
Expand All @@ -21,16 +21,22 @@ jobs:
with:
ruby-version: ${{ matrix.ruby-version }}

- uses: actions/cache@v1
- uses: actions/cache@v2
with:
path: vendor/bundle
key: gems-${{ runner.os }}-${{ matrix.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
gems-${{ runner.os }}-${{ matrix.ruby-version }}-
gems-${{ runner.os }}-

# necessary to get ruby 2.3 to work nicely with bundler vendor/bundle cache
# can remove once ruby 2.3 is no longer supported
- run: gem update --system

- run: bundle config set deployment 'true'
- run: bundle install
- name: bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- run: bundle exec middleman build
16 changes: 13 additions & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ on:

jobs:
deploy:
permissions:
contents: write

runs-on: ubuntu-latest
env:
ruby-version: 2.5
ruby-version: 2.6

steps:
- uses: actions/checkout@v2
Expand All @@ -17,13 +20,19 @@ jobs:
with:
ruby-version: ${{ env.ruby-version }}

- uses: actions/cache@v1
- uses: actions/cache@v2
with:
path: vendor/bundle
key: gems-${{ runner.os }}-${{ env.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
gems-${{ runner.os }}-${{ env.ruby-version }}-
gems-${{ runner.os }}-

- run: bundle config set deployment 'true'
- run: bundle install
- name: bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3

- run: bundle exec middleman build

Expand All @@ -32,3 +41,4 @@ jobs:
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
keep_files: true
85 changes: 85 additions & 0 deletions .github/workflows/dev_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Dev Deploy

on:
push:
branches: [ 'dev' ]

jobs:
push_to_registry:
runs-on: ubuntu-latest

steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
slatedocs/slate
tags: |
type=ref,event=branch

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_KEY }}

- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

deploy_gh:
permissions:
contents: write

runs-on: ubuntu-latest
env:
ruby-version: 2.6

steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ env.ruby-version }}

- uses: actions/cache@v2
with:
path: vendor/bundle
key: gems-${{ runner.os }}-${{ env.ruby-version }}-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
gems-${{ runner.os }}-${{ env.ruby-version }}-
gems-${{ runner.os }}-
- run: bundle config set deployment 'true'
- name: bundle install
run: |
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- run: bundle exec middleman build

- name: Deploy
uses: peaceiris/actions-gh-pages@v3.7.0-8
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
destination_dir: dev
publish_dir: ./build
keep_files: true
47 changes: 47 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish Docker image

on:
release:
types: [published]

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: all

- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: slatedocs/slate
tags: |
type=ref,event=tag

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_ACCESS_KEY }}

- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
builder: ${{ steps.buildx.outputs.name }}
context: .
file: ./Dockerfile
platforms: linux/amd64,linux/arm64,linux/ppc64le
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
78 changes: 78 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,83 @@
# Changelog

## Version 2.13.0

*April 22, 2022*

* __Drop support for ruby 2.5__
* Bump rouge from 3.26.1 to 3.28.0
* Formally support ruby 3.1
* Bump nokogiri from 1.12.5 to 1.13.4
* Build docker images for multiple architectures (e.g. `aarch64`)
* Remove `VOLUME` declaration from Dockerfile (thanks @aemengo)

The security vulnerabilities reported against recent versions of nokogiri should not affect slate users with a regular setup.

## Version 2.12.0

*November 04, 2021*

* Bump nokogiri from 1.12.3 to 1.12.5
* Bump ffi from 1.15.0 to 1.15.4
* Bump rouge from 3.26.0 to 3.26.1
* Bump middleman from 4.4.0 to 4.4.2
* Remove unnecessary files from docker images

## Version 2.11.0

*August 12, 2021*

* __[Security]__ Bump addressable transitive dependency from 2.7.0 to 2.8.0
* Support specifying custom meta tags in YAML front-matter
* Bump nokogiri from 1.11.3 to 1.12.3 (minimum supported version is 1.11.4)
* Bump middleman-autoprefixer from 2.10.1 to 3.0.0
* Bump jquery from 3.5.1 to 3.6.0
* Bump middleman from [`d180ca3`](https://github.com/middleman/middleman/commit/d180ca337202873f2601310c74ba2b6b4cf063ec) to 4.4.0

## Version 2.10.0

*April 13, 2021*

* Add support for Ruby 3.0 (thanks @shaun-scale)
* Add requirement for Git on installing dependencies
* Bump nokogiri from 1.11.2 to 1.11.3
* Bump middleman from 4.3.11 to [`d180ca3`](https://github.com/middleman/middleman/commit/d180ca337202873f2601310c74ba2b6b4cf063ec)

## Version 2.9.2

*March 30, 2021*

* __[Security]__ Bump kramdown from 2.3.0 to 2.3.1
* Bump nokogiri from 1.11.1 to 1.11.2

## Version 2.9.1

*February 27, 2021*

* Fix Slate language tabs not working if localStorage is disabled

## Version 2.9.0

*January 19, 2021*

* __Drop support for Ruby 2.3 and 2.4__
* __[Security]__ Bump nokogiri from 1.10.10 to 1.11.1
* __[Security]__ Bump redcarpet from 3.5.0 to 3.5.1
* Specify slate is not supported on Ruby 3.x
* Bump rouge from 3.24.0 to 3.26.0

## Version 2.8.0

*October 27, 2020*

* Remove last trailing newline when using the copy code button
* Rework docker image and make available at slatedocs/slate
* Improve Dockerfile layout to improve caching (thanks @micvbang)
* Bump rouge from 3.20 to 3.24
* Bump nokogiri from 1.10.9 to 1.10.10
* Bump middleman from 4.3.8 to 4.3.11
* Bump lunr.js from 2.3.8 to 2.3.9

## Version 2.7.1

*August 13, 2020*
Expand Down
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,25 @@ FROM ruby:2.6-slim

WORKDIR /srv/slate

VOLUME /srv/slate/source
EXPOSE 4567

COPY . /srv/slate
COPY Gemfile .
COPY Gemfile.lock .

RUN apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
git \
nodejs \
&& gem install bundler \
&& bundle install \
&& apt-get remove -y build-essential \
&& apt-get remove -y build-essential git \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*

CMD ["bundle", "exec", "middleman", "server", "--watcher-force-polling"]
COPY . /srv/slate

RUN chmod +x /srv/slate/slate.sh

ENTRYPOINT ["/srv/slate/slate.sh"]
CMD ["build"]
11 changes: 6 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
ruby '>=2.3.1'
ruby '>= 2.6'
source 'https://rubygems.org'

# Middleman
gem 'middleman', '~>4.3'
gem 'middleman', '~> 4.4'
gem 'middleman-syntax', '~> 3.2'
gem 'middleman-autoprefixer', '~> 2.7'
gem 'middleman-autoprefixer', '~> 3.0'
gem 'middleman-sprockets', '~> 4.1'
gem 'rouge', '~> 3.20'
gem 'rouge', '~> 3.21'
gem 'redcarpet', '~> 3.5.0'
gem 'nokogiri', '~> 1.10.8'
gem 'nokogiri', '~> 1.13.3'
gem 'sass'
gem 'webrick'
Loading