Skip to content

Nightly Build

Nightly Build #358

Workflow file for this run

name: Nightly Build
on:
push:
tags:
- "v*.*.*-*"
schedule:
- cron: "0 0 * * *" # Run every day at 00:00 UTC
workflow_dispatch:
env:
DOCKER_PLATFORMS: |
linux/386
linux/amd64
linux/amd64/v2
linux/amd64/v3
linux/arm/v5
linux/arm/v6
linux/arm/v7
linux/arm64
linux/ppc64le
linux/riscv64
linux/s390x
QEMU_PLATFORMS: |
linux/386
linux/amd64
linux/arm/v6
linux/arm/v7
linux/arm64
linux/ppc64le
linux/riscv64
linux/s390x
# Variables set by scripts/ci.py
GORELEASER_PREVIOUS_TAG: "[not set]"
GORELEASER_CURRENT_TAG: "[not set]"
BUILD_VERSION: "[not set]"
CACHE_KEY: "[not set]"
MEMOS_VERSION: "[not set]"
jobs:
front-end:
name: Build front-end
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: { fetch-depth: 0 }
# setup deps
- name: Setup Just
uses: taiki-e/install-action@2d31e9510b5117608dd543528c26ab9c080b2bd3
with: { tool: just@1.34.0 }
- name: Setup pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2
with: { version: 9 }
- name: Setup Node
uses: actions/setup-node@0a44ba7841725637a19e28fa30b79a866c81b0a6
with:
node-version: 20
cache: pnpm
cache-dependency-path: "memos/web/pnpm-lock.yaml"
# /setup deps
- name: Setup environment variables
run: just setup-env --nightly
- name: Pull latest changes from usememos/memos:main to subtree
run: just git-commit-any && just git-subtree-pull main
- name: Build front-end
run: just build-frontend
- name: Upload front-end artifact
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: frontend_${{env.BUILD_VERSION}}
compression-level: 9
if-no-files-found: error
path: memos/server/router/frontend/dist/
goreleaser:
name: Build
runs-on: ubuntu-24.04
permissions:
actions: read # required by wait action
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with: { fetch-depth: 0 }
# setup deps
- name: Setup Just
uses: taiki-e/install-action@2d31e9510b5117608dd543528c26ab9c080b2bd3
with: { tool: just@1.34.0 }
- name: Setup buf
uses: bufbuild/buf-setup-action@35c243d7f2a909b1d4e40399b348a7fdab27d78d
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
version: "1.34.0"
- name: Setup UPX
uses: crazy-max/ghaction-upx@0fc45e912669ba9e8fa2b430e97c8da2a632e29b
with: { install-only: true }
- name: Setup Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32
with:
go-version: "1.23"
check-latest: true
cache-dependency-path: memos/go.sum
- name: Setup Goreleaser
uses: jaxxstorm/action-install-gh-release@25d5e2dd555cd74f1fab9ac1e6ea117acde2c0c4
with:
repo: goreleaser/goreleaser
cache: enable
tag: "v2.1.0"
# /setup deps
- name: Setup environment variables
run: just setup-env --nightly
- name: Pull latest changes from usememos/memos:main to subtree
run: just git-commit-any && just git-subtree-pull main
### Front-end ###
- name: Wait for the front-end build to finish
uses: yogeshlonkar/wait-for-jobs@1c2827adaa4b61e1c42688b1cf9cbc128f24531c
with:
jobs: "Build front-end"
interval: "2000"
ttl: "10"
- name: Download front-end artifact
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16
with:
name: frontend_${{env.BUILD_VERSION}}
path: memos/server/router/frontend/dist/
- run: ls -R memos/server/router/frontend/dist/
### /Front-end ###
- name: Nightly build
run: just build-nightly-backend-only
- name: Create pre-release
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8
with:
files: |
build/*.tar.gz
build/*.zip
build/*.txt
body: |
This is an **untested** pre-release, built with bleeding-edge upstream Memos code.
It is strongly recommended that you do *not* use it in production.
*Ensure that you use a different database than the one you use for stable releases.*
Version identifier `${{ env.BUILD_VERSION }}` is auto-generated, based on what is set at Memos upstream on `version.go` file. Therefore, pre-release versioning is subject to change without notice.
Release assets may be overwritten by the daily automated builds if the upstream Memos version hasn't changed.
**[Official Memos upstream changelog](https://github.com/usememos/memos/compare/v${{ env.MEMOS_VERSION }}...main)**
tag_name: ${{ env.BUILD_VERSION }}
draft: false
prerelease: true
### Docker ###
- name: Rename goreleaser builds to the format expected by current Dockerfile
run: just rename-to-docker
- name: Setup QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf
with:
platforms: ${{ env.QEMU_PLATFORMS }}
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349
with:
version: latest
install: true
platforms: ${{ env.DOCKER_PLATFORMS }}
- name: Log-in to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
username: lincolnthalles
password: ${{ secrets.DOCKER_TOKEN }}
- name: Log-in to GitHub's Container registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}
- name: Docker meta
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
with:
images: |
lincolnthalles/memos
ghcr.io/memospot/memos-builds
tags: type=raw,value=nightly
- name: Build and Push Docker images
uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445
with:
context: ./
file: ./docker/Dockerfile
platforms: ${{ env.DOCKER_PLATFORMS }}
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
### /Docker ###