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

WIP: allow non github contribs #1687

Closed
wants to merge 7 commits into from
Closed
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
73 changes: 73 additions & 0 deletions .github/workflows/devel-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Create a Docker image for development and publish it to GitHub registry.
name: Create Development Image

on:
pull_request:
branches:
- master

jobs:
# Format code
format:
name: Format code
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Checkout master
run: git checkout master
- name: Format code
run: |
npm install -g dprint
mkdir -v -p /home/runner/.cache/dprint/cache
npx dprint fmt --config .github/config/dprint.json
- name: Publish formatted code
run: |
set +e
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git add --all
git commit -m "chore: code formatting"
git push
set -e

update-indexes:
name: Publish rebuilt metrics indexes
runs-on: ubuntu-latest
needs: [ format ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup NodeJS
uses: actions/setup-node@v3
with:
node-version: 20
- name: Pull changes
run: |
git checkout master
git pull
- name: Setup metrics
run: npm ci
- name: Publish rebuild metrics indexes
run: npm run build -- publish

docker-devel:
name: Publish devel to GitHub registry
runs-on: ubuntu-latest
needs: [ update-indexes ]
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Login to GitHub registry
run: echo ${{ github.token }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Build docker image
run: docker build -t ghcr.io/${{ github.actor }}/lowlighter-github-metrics:devel .

- name: Publish to GitHub registry
run: docker push ghcr.io/${{ github.actor }}/lowlighter-github-metrics:devel
40 changes: 20 additions & 20 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -6,28 +6,28 @@ COPY . /metrics
WORKDIR /metrics

# Setup
RUN chmod +x /metrics/source/app/action/index.mjs \
# Install latest chrome dev package, fonts to support major charsets and skip chromium download on puppeteer install
# Based on https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
&& apt-get update \
&& apt-get install -y wget gnupg ca-certificates libgconf-2-4 \
RUN chmod +x /metrics/source/app/action/index.mjs
# Install latest chrome dev package, fonts to support major charsets and skip chromium download on puppeteer install
# Based on https://github.com/GoogleChrome/puppeteer/blob/master/docs/troubleshooting.md#running-puppeteer-in-docker
RUN apt-get -q update \
&& apt-get -q install -y build-essential wget gnupg ca-certificates libgconf-2-4 \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 libx11-xcb1 libxtst6 lsb-release --no-install-recommends \
# Install deno for miscellaneous scripts
&& apt-get install -y curl unzip \
&& curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh \
# Install ruby to support github licensed gem
&& apt-get install -y ruby-full git g++ cmake pkg-config libssl-dev \
&& gem install licensed \
# Install python for node-gyp
&& apt-get install -y python3 \
# Clean apt/lists
&& rm -rf /var/lib/apt/lists/* \
# Install node modules and rebuild indexes
&& npm ci \
&& npm run build
&& apt-get -q update \
&& apt-get -q install -y google-chrome-stable fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf libxss1 libx11-xcb1 libxtst6 lsb-release --no-install-recommends
# Install deno for miscellaneous scripts
RUN apt-get install -y curl unzip \
&& curl -fsSL https://deno.land/x/install/install.sh | DENO_INSTALL=/usr/local sh
# Install ruby to support github licensed gem
RUN apt-get -q install -y ruby-full git g++ cmake pkg-config libssl-dev \
&& apt-get -q install -y ruby-dev \
&& gem install licensed
# Install python for node-gyp
RUN apt-get -q install -y python3
# Clean apt/lists
RUN rm -rf /var/lib/apt/lists/*
# Install node modules and rebuild indexes
RUN npm ci && npm run build

# Environment variables
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true
Loading
Oops, something went wrong.
Loading
Oops, something went wrong.