-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f799f14
commit 5861b1d
Showing
12 changed files
with
250 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
node_modules | ||
README.md | ||
.github | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: docker-publish | ||
description: Publish the Docker image to GH Container Registry | ||
inputs: | ||
githubToken: | ||
description: "Token to access private GH Docker registry" | ||
required: true | ||
tags: | ||
description: "Tags to assign for the published docker container" | ||
required: true | ||
build-args: | ||
description: "Build args" | ||
required: false | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Login to GitHub Packages Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ inputs.githubToken }} | ||
registry: ghcr.io | ||
- name: Build and push | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: true | ||
tags: ${{ inputs.tags }} | ||
build-args: ${{ inputs.build-args }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: pnpm-install | ||
description: Install Node, pnpm and dependencies | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install Node | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 20 | ||
- uses: pnpm/action-setup@v3 | ||
with: | ||
version: 8 | ||
run_install: false | ||
- name: Get pnpm store directory | ||
shell: bash | ||
run: | | ||
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | ||
- uses: actions/cache@v3 | ||
name: Setup pnpm cache | ||
with: | ||
path: ${{ env.STORE_PATH }} | ||
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | ||
restore-keys: | | ||
${{ runner.os }}-pnpm-store- | ||
- name: Install dependencies | ||
run: pnpm i --frozen-lockfile | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: build | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: ./.github/actions/pnpm-install | ||
- run: pnpm lint | ||
- run: pnpm build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: release-docker-develop | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: release-docker-develop | ||
|
||
env: | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.runner }} | ||
strategy: | ||
matrix: | ||
include: | ||
- runner: buildjet-8vcpu-ubuntu-2204-arm | ||
arch: arm64 | ||
- runner: ubuntu-latest | ||
arch: amd64 | ||
permissions: | ||
packages: write | ||
contents: read | ||
outputs: | ||
SHORT_SHA: ${{ steps.git-commit.outputs.SHORT_SHA }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get git commit | ||
id: git-commit | ||
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> "$GITHUB_OUTPUT" | ||
- uses: ./.github/actions/docker-publish | ||
with: | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
tags: ghcr.io/kennethwussmann/github-archive:${{ matrix.arch }}-${{ steps.git-commit.outputs.SHORT_SHA }} | ||
build-args: VERSION=${{ steps.git-commit.outputs.SHORT_SHA }} | ||
|
||
create-and-push-manifest: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Login to GitHub Packages Docker Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
registry: ghcr.io | ||
- name: Create and push Docker manifest | ||
run: | | ||
docker manifest create ghcr.io/kennethwussmann/github-archive:develop \ | ||
--amend ghcr.io/kennethwussmann/github-archive:amd64-${{ needs.build.outputs.SHORT_SHA }} \ | ||
--amend ghcr.io/kennethwussmann/github-archive:arm64-${{ needs.build.outputs.SHORT_SHA }} | ||
docker manifest push ghcr.io/kennethwussmann/github-archive:develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: release-docker-latest | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
concurrency: release-docker-latest | ||
|
||
env: | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.runner }} | ||
strategy: | ||
matrix: | ||
include: | ||
- runner: buildjet-8vcpu-ubuntu-2204-arm | ||
arch: arm64 | ||
- runner: ubuntu-latest | ||
arch: amd64 | ||
permissions: | ||
packages: write | ||
contents: read | ||
outputs: | ||
tag: ${{ steps.vars.outputs.tag }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Get version | ||
id: vars | ||
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} | ||
- uses: ./.github/actions/docker-publish | ||
with: | ||
githubToken: ${{ secrets.GITHUB_TOKEN }} | ||
tags: ghcr.io/kennethwussmann/github-archive:${{ matrix.arch }}-${{ steps.vars.outputs.tag }} | ||
build-args: VERSION=${{ steps.vars.outputs.tag }} | ||
|
||
create-and-push-manifest: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
permissions: | ||
packages: write | ||
contents: read | ||
steps: | ||
- name: Login to GitHub Packages Docker Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
registry: ghcr.io | ||
- name: Create and push Docker manifest | ||
run: | | ||
docker manifest create ghcr.io/kennethwussmann/github-archive:${{ needs.build.outputs.tag }} \ | ||
--amend ghcr.io/kennethwussmann/github-archive:amd64-${{ needs.build.outputs.tag }} \ | ||
--amend ghcr.io/kennethwussmann/github-archive:arm64-${{ needs.build.outputs.tag }} | ||
docker manifest push ghcr.io/kennethwussmann/github-archive:${{ needs.build.outputs.tag }} | ||
docker manifest create ghcr.io/kennethwussmann/github-archive:latest \ | ||
--amend ghcr.io/kennethwussmann/github-archive:amd64-${{ needs.build.outputs.tag }} \ | ||
--amend ghcr.io/kennethwussmann/github-archive:arm64-${{ needs.build.outputs.tag }} | ||
docker manifest push ghcr.io/kennethwussmann/github-archive:latest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
ARG NODE_VERSION=20 | ||
FROM node:${NODE_VERSION}-slim AS builder | ||
|
||
RUN apt-get update && apt-get install -y python3 build-essential | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN npm install -g pnpm@8 | ||
RUN pnpm install --frozen-lockfile | ||
RUN pnpm build | ||
|
||
FROM node:${NODE_VERSION}-slim | ||
|
||
WORKDIR /app | ||
|
||
ARG NODE_ENV=production | ||
ENV NODE_ENV=${NODE_ENV} | ||
|
||
ARG VERSION=develop | ||
ENV VERSION=${VERSION} | ||
LABEL org.opencontainers.image.source https://github.com/KennethWussmann/github-archive | ||
|
||
COPY --from=builder /app/build/index.js /app/index.js | ||
|
||
CMD [ "index.js" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
services: | ||
github-archive: | ||
build: . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { rootLogger } from "./utils/logger"; | ||
|
||
const start = async () => { | ||
rootLogger.info("Starting GitHub archiver"); | ||
await new Promise((resolve) => setTimeout(resolve, 100000)); | ||
}; | ||
|
||
void start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters