mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
ci: restore release candidate workflow and use reusable actions
This commit is contained in:
@@ -0,0 +1,63 @@
|
|||||||
|
name: Reusable Docker Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
image_name:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'solucetechnologies/portabase'
|
||||||
|
add_latest:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
target:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: 'prod'
|
||||||
|
dockerfile:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
|
default: './docker/dockerfile/Dockerfile'
|
||||||
|
secrets:
|
||||||
|
DOCKER_USERNAME:
|
||||||
|
required: true
|
||||||
|
DOCKER_PASSWORD:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
packages: write
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Set tags
|
||||||
|
id: set-tags
|
||||||
|
run: |
|
||||||
|
REF_NAME=${GITHUB_REF#refs/tags/}
|
||||||
|
TAGS="${{ inputs.image_name }}:$REF_NAME"
|
||||||
|
if [[ "${{ inputs.add_latest }}" == "true" ]]; then
|
||||||
|
TAGS="$TAGS,${{ inputs.image_name }}:latest"
|
||||||
|
fi
|
||||||
|
echo "tags=$TAGS" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Build and push Docker image
|
||||||
|
uses: docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ${{ inputs.dockerfile }}
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.set-tags.outputs.tags }}
|
||||||
|
target: ${{ inputs.target }}
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
name: Reusable GitHub Release
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
prerelease:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
make_latest:
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
discord_title:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
discord_color:
|
||||||
|
required: true
|
||||||
|
type: number
|
||||||
|
discord_footer:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
DISCORD_WEBHOOK:
|
||||||
|
required: true
|
||||||
|
GH_TOKEN:
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
create-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
steps:
|
||||||
|
- name: Check out the repo
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Build Changelog
|
||||||
|
id: build_changelog
|
||||||
|
uses: mikepenz/release-changelog-builder-action@v5
|
||||||
|
with:
|
||||||
|
mode: "COMMIT"
|
||||||
|
configurationJson: |
|
||||||
|
{
|
||||||
|
"template": "#{{CHANGELOG}}",
|
||||||
|
"categories": [
|
||||||
|
{
|
||||||
|
"title": "## Feature",
|
||||||
|
"labels": ["feat", "feature"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "## Fix",
|
||||||
|
"labels": ["fix", "bug"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"title": "## Other",
|
||||||
|
"labels": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"label_extractor": [
|
||||||
|
{
|
||||||
|
"pattern": "^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test){1}(\([\w\-\.]+\))?(!)?: ([\w ])+([\s\S]*)",
|
||||||
|
"on_property": "title",
|
||||||
|
"target": "$1"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
generate_release_notes: false
|
||||||
|
body: ${{ steps.build_changelog.outputs.changelog }}
|
||||||
|
prerelease: ${{ inputs.prerelease }}
|
||||||
|
make_latest: ${{ inputs.make_latest }}
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Send Discord Notification
|
||||||
|
env:
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||||
|
run: |
|
||||||
|
RELEASE_INFO=$(gh release view "${{ github.ref_name }}" -R ${{ github.repository }} --json name,url,body,author)
|
||||||
|
|
||||||
|
RELEASE_TITLE=$(echo "$RELEASE_INFO" | jq -r .name)
|
||||||
|
if [ -z "$RELEASE_TITLE" ] || [ "$RELEASE_TITLE" = "null" ]; then RELEASE_TITLE="${{ github.ref_name }}"; fi
|
||||||
|
|
||||||
|
RELEASE_URL=$(echo "$RELEASE_INFO" | jq -r .url)
|
||||||
|
RELEASE_BODY=$(echo "$RELEASE_INFO" | jq -r .body)
|
||||||
|
|
||||||
|
AUTHOR_NAME="Portabase"
|
||||||
|
AUTHOR_ICON="https://github.com/Portabase.png"
|
||||||
|
|
||||||
|
PAYLOAD=$(jq -n \
|
||||||
|
--arg title "$RELEASE_TITLE" \
|
||||||
|
--arg description "$RELEASE_BODY" \
|
||||||
|
--arg url "$RELEASE_URL" \
|
||||||
|
--arg author "$AUTHOR_NAME" \
|
||||||
|
--arg icon "$AUTHOR_ICON" \
|
||||||
|
--arg discord_title "${{ inputs.discord_title }}" \
|
||||||
|
--arg discord_footer "${{ inputs.discord_footer }}" \
|
||||||
|
--argjson discord_color ${{ inputs.discord_color }} \
|
||||||
|
'{
|
||||||
|
content: $discord_title,
|
||||||
|
embeds: [{
|
||||||
|
title: $title,
|
||||||
|
url: $url,
|
||||||
|
description: $description,
|
||||||
|
color: $discord_color,
|
||||||
|
author: {
|
||||||
|
name: $author,
|
||||||
|
icon_url: $icon
|
||||||
|
},
|
||||||
|
footer: {
|
||||||
|
text: $discord_footer
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}'
|
||||||
|
)
|
||||||
|
|
||||||
|
curl -H "Content-Type: application/json" \
|
||||||
|
-d "$PAYLOAD" \
|
||||||
|
"$DISCORD_WEBHOOK"
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
name: Publish Docker image for release candidate
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*-rc*'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker_publish:
|
||||||
|
uses: ./.github/workflows/docker.yml
|
||||||
|
with:
|
||||||
|
add_latest: false
|
||||||
|
secrets:
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
github_release:
|
||||||
|
needs: docker_publish
|
||||||
|
uses: ./.github/workflows/github.yml
|
||||||
|
with:
|
||||||
|
prerelease: true
|
||||||
|
make_latest: false
|
||||||
|
discord_title: "||@release-dashboard|| New release candidate published"
|
||||||
|
discord_color: 16776960
|
||||||
|
discord_footer: "Portabase RC"
|
||||||
|
secrets:
|
||||||
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
@@ -1,50 +1,29 @@
|
|||||||
name: Publish Docker image for release
|
name: Publish Docker image for new release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
push:
|
||||||
types: [published]
|
tags:
|
||||||
|
- '*.*.*'
|
||||||
|
- '!*-*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
push_to_registry:
|
docker_publish:
|
||||||
name: Push Docker image to Docker Hub
|
uses: ./.github/workflows/docker.yml
|
||||||
runs-on: ubuntu-latest
|
with:
|
||||||
permissions:
|
add_latest: true
|
||||||
packages: write
|
secrets:
|
||||||
contents: read
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
attestations: write
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
id-token: write
|
|
||||||
steps:
|
|
||||||
- name: Check out the repo
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
github_release:
|
||||||
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
|
needs: docker_publish
|
||||||
with:
|
uses: ./.github/workflows/github.yml
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
with:
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
prerelease: false
|
||||||
|
make_latest: true
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
discord_title: "||@release-dashboard|| New release published"
|
||||||
id: meta
|
discord_color: 5814783
|
||||||
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
discord_footer: "Portabase"
|
||||||
with:
|
secrets:
|
||||||
images: solucetechnologies/portabase
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
||||||
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
- name: Set tags
|
|
||||||
id: set-tags
|
|
||||||
run: |
|
|
||||||
echo "RELEASE_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
|
|
||||||
TAGS="solucetechnologies/portabase:${GITHUB_REF#refs/tags/}"
|
|
||||||
if [ "${{ github.event.release.target_commitish }}" = "main" ]; then
|
|
||||||
TAGS="$TAGS,solucetechnologies/portabase:latest"
|
|
||||||
fi
|
|
||||||
echo "tags=$TAGS" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
id: push
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./docker/dockerfile/Dockerfile
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.set-tags.outputs.tags }}
|
|
||||||
target: prod
|
|
||||||
Binary file not shown.
@@ -1,2 +0,0 @@
|
|||||||
nodeLinker: node-modules
|
|
||||||
|
|
||||||
@@ -1,45 +1,37 @@
|
|||||||
FROM node:22-alpine AS base
|
FROM node:22-alpine AS base
|
||||||
|
|
||||||
ENV YARN_VERSION=4.9.1
|
|
||||||
|
|
||||||
RUN apk add --update --no-cache \
|
RUN apk add --update --no-cache \
|
||||||
tzdata \
|
|
||||||
build-base \
|
|
||||||
libc6-compat \
|
libc6-compat \
|
||||||
openssl \
|
openssl \
|
||||||
make \
|
tzdata
|
||||||
|
|
||||||
|
FROM base AS build-env
|
||||||
|
|
||||||
|
RUN apk add --update --no-cache \
|
||||||
|
build-base \
|
||||||
g++ \
|
g++ \
|
||||||
jpeg-dev \
|
make \
|
||||||
cairo-dev \
|
|
||||||
giflib-dev \
|
|
||||||
pango-dev \
|
|
||||||
libtool \
|
libtool \
|
||||||
autoconf \
|
autoconf \
|
||||||
automake \
|
automake
|
||||||
libpng
|
|
||||||
|
|
||||||
RUN corepack enable && corepack prepare yarn@${YARN_VERSION}
|
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||||
RUN yarn set version ${YARN_VERSION}
|
|
||||||
|
|
||||||
|
|
||||||
FROM base AS deps
|
|
||||||
|
|
||||||
|
FROM build-env AS deps
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY .yarn ./.yarn
|
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml ./
|
||||||
COPY .yarnrc.yml ./
|
|
||||||
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml* ./
|
RUN pnpm i --frozen-lockfile
|
||||||
|
|
||||||
|
|
||||||
RUN \
|
|
||||||
if [ -f yarn.lock ]; then yarn; \
|
|
||||||
elif [ -f package-lock.json ]; then npm ci; \
|
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm i --frozen-lockfile; \
|
|
||||||
else echo "Lockfile not found." && exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
FROM base AS dev
|
FROM build-env AS dev
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
@@ -52,8 +44,11 @@ RUN chmod +x /app/docker/entrypoints/app-dev-entrypoint.sh
|
|||||||
ENTRYPOINT ["sh","/app/docker/entrypoints/app-dev-entrypoint.sh"]
|
ENTRYPOINT ["sh","/app/docker/entrypoints/app-dev-entrypoint.sh"]
|
||||||
|
|
||||||
|
|
||||||
# Rebuild the source code only when needed
|
|
||||||
FROM base AS builder
|
|
||||||
|
|
||||||
|
|
||||||
|
FROM build-env AS builder
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
@@ -61,12 +56,11 @@ COPY . .
|
|||||||
|
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
|
||||||
RUN \
|
RUN pnpm run build
|
||||||
if [ -f yarn.lock ]; then yarn run build; \
|
|
||||||
elif [ -f package-lock.json ]; then npm run build; \
|
|
||||||
elif [ -f pnpm-lock.yaml ]; then corepack enable pnpm && pnpm run build; \
|
|
||||||
else echo "Lockfile not found." && exit 1; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
FROM base AS prod
|
FROM base AS prod
|
||||||
@@ -109,5 +103,3 @@ ENV HOSTNAME="0.0.0.0"
|
|||||||
USER nextjs
|
USER nextjs
|
||||||
|
|
||||||
ENTRYPOINT ["sh","/app/app-prod-entrypoint.sh"]
|
ENTRYPOINT ["sh","/app/app-prod-entrypoint.sh"]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
echo "▶ Running Drizzle codegen..."
|
echo "▶ Running Drizzle codegen..."
|
||||||
npx drizzle-kit generate
|
pnpm drizzle-kit generate
|
||||||
|
|
||||||
echo "▶ Applying migrations..."
|
echo "▶ Applying migrations..."
|
||||||
npx drizzle-kit migrate
|
pnpm drizzle-kit migrate
|
||||||
|
|
||||||
echo "▶ Starting Next.js dev server..."
|
echo "▶ Starting Next.js dev server..."
|
||||||
exec npm run dev
|
exec pnpm dev
|
||||||
+3
-1
@@ -97,6 +97,7 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@iconify/react": "^6.0.0",
|
"@iconify/react": "^6.0.0",
|
||||||
"@react-email/preview-server": "4.3.2",
|
"@react-email/preview-server": "4.3.2",
|
||||||
|
"@react-email/render": "^2.0.1",
|
||||||
"@tailwindcss/postcss": "^4.1.7",
|
"@tailwindcss/postcss": "^4.1.7",
|
||||||
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
"@types/eslint-plugin-tailwindcss": "^3.17.0",
|
||||||
"@types/node": "^22.15.18",
|
"@types/node": "^22.15.18",
|
||||||
@@ -111,6 +112,7 @@
|
|||||||
"eslint": "^9.39.0",
|
"eslint": "^9.39.0",
|
||||||
"eslint-config-next": "^16.0.1",
|
"eslint-config-next": "^16.0.1",
|
||||||
"eslint-plugin-tailwindcss": "^3.18.0",
|
"eslint-plugin-tailwindcss": "^3.18.0",
|
||||||
|
"framer-motion": "^12.24.7",
|
||||||
"postcss": "^8.5.3",
|
"postcss": "^8.5.3",
|
||||||
"tailwindcss": "^4.1.7",
|
"tailwindcss": "^4.1.7",
|
||||||
"tsx": "^4.19.4",
|
"tsx": "^4.19.4",
|
||||||
@@ -118,5 +120,5 @@
|
|||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"zenstack": "2.14.2"
|
"zenstack": "2.14.2"
|
||||||
},
|
},
|
||||||
"packageManager": "yarn@4.9.1"
|
"packageManager": "pnpm@10.27.0"
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+14158
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
|||||||
|
onlyBuiltDependencies:
|
||||||
|
- zenstack
|
||||||
Reference in New Issue
Block a user