Skip to content

Commit 5ba89b1

Browse files
Add docker and Makefiles (#7)
* Add docker and Makefiles * Add workflows
1 parent 73f4517 commit 5ba89b1

6 files changed

Lines changed: 128 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Automatically mark PRs to sync"
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
8+
jobs:
9+
labeler:
10+
if: github.event.pull_request.user.type != 'Bot'
11+
permissions:
12+
pull-requests: write
13+
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Add "sync" label to PR
17+
run: gh pr edit "$PR_URL" --add-label sync --repo "$PR_REPO"
18+
env:
19+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
PR_URL: ${{ github.event.pull_request.html_url }}
21+
PR_REPO: ${{ github.repository }}
22+
23+
- name: Comment on PR to explain sync label
24+
run: gh pr comment "$PR_URL" --body "This pull request has been marked to **automatically sync** to its base branch. You can **disable** this behavior by removing the `sync` label." --repo "$PR_REPO"
25+
env:
26+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
27+
PR_URL: ${{ github.event.pull_request.html_url }}
28+
PR_REPO: ${{ github.repository }}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Automatically enable auto-merge on PRs"
2+
3+
on:
4+
pull_request_target:
5+
types:
6+
- opened
7+
- ready_for_review
8+
branches:
9+
- main
10+
11+
jobs:
12+
enable-automerge:
13+
if: github.event.pull_request.draft == false
14+
permissions:
15+
pull-requests: write
16+
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Enable auto-merge for the PR
20+
run: gh pr merge "$PR_URL" --auto --squash
21+
env:
22+
GH_TOKEN: ${{ secrets.PR_AUTO_UPDATE_TOKEN }}
23+
PR_URL: ${{ github.event.pull_request.html_url }}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: pr-auto-update
2+
on:
3+
push: {}
4+
5+
jobs:
6+
pr-auto-update:
7+
name: Automatic PR Updater
8+
runs-on: ubuntu-latest
9+
permissions:
10+
pull-requests: write
11+
contents: write
12+
steps:
13+
- name: Generate Access Token
14+
uses: actions/create-github-app-token@v2
15+
id: generate-token
16+
with:
17+
app-id: ${{ vars.PR_AUTO_UPDATE_CLIENT_ID }}
18+
private-key: ${{ secrets.PR_AUTO_UPDATE_PRIVATE_KEY }}
19+
20+
- uses: CSSUoB/pr-auto-updater@v2.3.1
21+
env:
22+
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
23+
PR_FILTER: 'labelled'
24+
PR_LABELS: 'sync'
25+
MERGE_CONFLICT_ACTION: 'label'
26+
MERGE_CONFLICT_LABEL: 'conflict'

Dockerfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ruby:4.0.1 AS base
2+
3+
RUN bundle config set frozen 'true' && \
4+
bundle config set path '/vendor/bundle'
5+
6+
WORKDIR /usr/src/app
7+
8+
COPY Gemfile Gemfile.lock ./
9+
RUN bundle install
10+
11+
COPY . .
12+
13+
FROM base AS build-step
14+
RUN bundle exec jekyll build
15+
16+
FROM scratch AS build
17+
COPY --from=build-step /usr/src/app/_site /
18+
19+
FROM base AS server
20+
EXPOSE 4000
21+
CMD bundle exec jekyll serve --host 0.0.0.0 --port 4000 --destination /tmp/_site

Makefile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.PHONY: all build serve clean
2+
3+
all: build
4+
5+
build: clean
6+
docker buildx build . --target build --output type=local,dest=./_site
7+
8+
serve:
9+
docker compose up --build
10+
11+
clean:
12+
rm -rf _site
13+
14+
fmt:
15+
npm run format:fix
16+
17+
lint:
18+
npm run lint:fix
19+
20+
spellcheck:
21+
npm run spellcheck:staged

docker-compose.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
services:
2+
jekyll:
3+
build:
4+
context: .
5+
target: server
6+
volumes:
7+
- "./:/usr/src/app"
8+
ports:
9+
- "4000:4000"

0 commit comments

Comments
 (0)