mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-09 20:12:10 +10:00
feat: supply drop version during release build
This commit is contained in:
29
.github/workflows/release.yml
vendored
29
.github/workflows/release.yml
vendored
@ -20,8 +20,33 @@ jobs:
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: true
|
||||
fetch-tags: true
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Get base tag
|
||||
id: get_base_tag
|
||||
run: |
|
||||
BASE_TAG=$(git describe --tags --abbrev=0)
|
||||
echo "base_tag=$BASE_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Determine final tag
|
||||
id: get_final_tag
|
||||
run: |
|
||||
BASE_TAG=${{ steps.get_base_tag.outputs.base_tag }}
|
||||
TODAY=$(date +'%Y.%m.%d')
|
||||
|
||||
echo "Today will be: $TODAY"
|
||||
echo "today=$TODAY" >> $GITHUB_OUTPUT
|
||||
|
||||
if [[ "${{ github.event_name }}" == "release" ]]; then
|
||||
FINAL_TAG="$BASE_TAG"
|
||||
else
|
||||
FINAL_TAG="${BASE_TAG}-nightly.$TODAY"
|
||||
fi
|
||||
|
||||
echo "Drop's release tag will be: $FINAL_TAG"
|
||||
echo "final_tag=$FINAL_TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
@ -45,7 +70,7 @@ jobs:
|
||||
images: |
|
||||
ghcr.io/drop-OSS/drop
|
||||
tags: |
|
||||
type=schedule,pattern=nightly
|
||||
type=schedule,pattern=nightly.${{ steps.get_final_tag.outputs.today }}
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=v{{major}}.{{minor}}
|
||||
type=semver,pattern=v{{major}}
|
||||
@ -66,3 +91,5 @@ jobs:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
build-args: |
|
||||
BUILD_DROP_VERSION=${{ steps.get_final_tag.outputs.final_tag }}
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# Unified deps builder
|
||||
FROM node:lts-alpine AS deps
|
||||
WORKDIR /app
|
||||
@ -12,10 +14,15 @@ WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV NUXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# add git so drop can determine its git ref at build
|
||||
RUN apk add git
|
||||
|
||||
# copy deps and rest of project files
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
|
||||
ARG BUILD_DROP_VERSION="v0.0.0-unknown.1"
|
||||
|
||||
# build
|
||||
RUN yarn postinstall
|
||||
RUN yarn build
|
||||
|
||||
@ -92,6 +92,7 @@ export default defineTask<TaskReturn>({
|
||||
};
|
||||
}
|
||||
|
||||
// TODO: handle prerelease identifiers https://github.com/npm/node-semver#prerelease-identifiers
|
||||
// check if is newer version
|
||||
if (semver.gt(latestVer, currVer)) {
|
||||
console.log("[Task check:update]: Update available");
|
||||
|
||||
Reference in New Issue
Block a user