From e98cccc6561d8d42ee2c8c7333040e00e49a7e88 Mon Sep 17 00:00:00 2001 From: Ashhhleyyy Date: Mon, 25 Jul 2022 19:55:13 +0100 Subject: [PATCH] feat: experimental CI pipeline --- .drone.yml | 36 ++++++++++++++++++++++++++++++++++++ next.config.js | 1 + scripts/build-release.sh | 15 +++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 .drone.yml create mode 100755 scripts/build-release.sh diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..40b8c89 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,36 @@ +kind: pipeline +type: docker +name: Build +platform: + os: linux + arch: arm64 +steps: +- name: Install dependencies + image: node-pnpm:16-alpine + commands: + - pnpm install --frozen-lockfile +- name: Check formatting + image: node-pnpm:16-alpine + commands: + - pnpm format:check +- name: Lint code + image: node-pnpm:16-alpine + commands: + - pnpm lint +- name: Build site + image: node-pnpm:16-alpine + commands: + - pnpm build +- name: Create bundle + image: alpine + commands: + - scripts/build-release.sh +- name: Push bundle + image: alpine + commands: + - apk add curl ca-certificates + - 'curl --fail --upload-file @comicbox.tar.gz --user robot:$ROBOT_TOKEN https://git.ashhhleyyy.dev/api/packages/robot/generic/comicbox/0.1.0+git.${DRONE_COMMIT_SHA:0:8}/comicbox.tar.gz' + +trigger: + event: [push] + branch: [main] diff --git a/next.config.js b/next.config.js index ad874a6..abdbbff 100755 --- a/next.config.js +++ b/next.config.js @@ -5,6 +5,7 @@ const nextConfig = { images: { domains: ['img.comicfury.com'], }, + output: 'standalone', }; module.exports = nextConfig; diff --git a/scripts/build-release.sh b/scripts/build-release.sh new file mode 100755 index 0000000..a5dd019 --- /dev/null +++ b/scripts/build-release.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env sh + +set -e -u -o pipefail + +echo Building production TAR... + +mkdir -p comicbox/ +mkdir -p comicbox/.next/ + +cp -r .next/standalone/* comicbox/ +cp -r .next/static/ comicbox/.next/ +cp next.config.js comicbox/ +cp -r public/ comicbox/ + +tar -cvzf comicbox.tar.gz comicbox/