mirror of https://github.com/usememos/memos.git
chore: merge release action
This commit is contained in:
parent
dc5f37ebba
commit
33907539cd
|
|
@ -1,72 +0,0 @@
|
||||||
name: Build and Push Release Image by Branch
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
# Run on pushing branches like 'release/1.0.0'.
|
|
||||||
- "release/*"
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-and-push-release-image:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
packages: write
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
|
|
||||||
- name: Extract build args
|
|
||||||
# Extract version from tag name
|
|
||||||
# Example: tag name `release/1.0.0` sets up env.VERSION=1.0.0
|
|
||||||
run: |
|
|
||||||
echo "VERSION=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_HUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.actor }}
|
|
||||||
password: ${{ github.token }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
install: true
|
|
||||||
version: v0.9.1
|
|
||||||
|
|
||||||
- name: Docker meta
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: |
|
|
||||||
neosmemo/memos
|
|
||||||
ghcr.io/usememos/memos
|
|
||||||
tags: |
|
|
||||||
type=semver,pattern={{version}},value=${{ env.VERSION }}
|
|
||||||
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }}
|
|
||||||
type=raw,value=stable
|
|
||||||
flavor: |
|
|
||||||
latest=false
|
|
||||||
labels: |
|
|
||||||
org.opencontainers.image.version=${{ env.VERSION }}
|
|
||||||
|
|
||||||
- name: Build and Push
|
|
||||||
id: docker_build
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
file: ./scripts/Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
|
|
@ -1,13 +1,20 @@
|
||||||
name: Build and Push Release Image by Tag
|
name: Build and Push Stable Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
branches:
|
||||||
|
- "release/**"
|
||||||
tags:
|
tags:
|
||||||
# Match stable versions, such as 'v1.0.0'.
|
|
||||||
- "v*.*.*"
|
- "v*.*.*"
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_PLATFORMS: |
|
||||||
|
linux/amd64
|
||||||
|
linux/arm/v7
|
||||||
|
linux/arm64
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push-stable-image:
|
build-and-push-image:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
@ -17,11 +24,24 @@ jobs:
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@v3
|
uses: docker/setup-qemu-action@v3
|
||||||
|
with:
|
||||||
|
platforms: ${{ env.DOCKER_PLATFORMS }}
|
||||||
|
|
||||||
- name: Extract build args
|
- name: Set up Docker Buildx
|
||||||
# Extract version number and check if it's an rc version
|
id: buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
with:
|
||||||
|
version: latest
|
||||||
|
install: true
|
||||||
|
platforms: ${{ env.DOCKER_PLATFORMS }}
|
||||||
|
|
||||||
|
- name: Extract version
|
||||||
run: |
|
run: |
|
||||||
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
|
if [[ "$GITHUB_REF_TYPE" == "tag" ]]; then
|
||||||
|
echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_ENV
|
||||||
|
else
|
||||||
|
echo "VERSION=${GITHUB_REF_NAME#release/}" >> $GITHUB_ENV
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
|
|
@ -36,13 +56,6 @@ jobs:
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
password: ${{ github.token }}
|
password: ${{ github.token }}
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
id: buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
with:
|
|
||||||
install: true
|
|
||||||
version: v0.9.1
|
|
||||||
|
|
||||||
- name: Docker meta
|
- name: Docker meta
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@v5
|
uses: docker/metadata-action@v5
|
||||||
|
|
@ -59,13 +72,28 @@ jobs:
|
||||||
labels: |
|
labels: |
|
||||||
org.opencontainers.image.version=${{ env.VERSION }}
|
org.opencontainers.image.version=${{ env.VERSION }}
|
||||||
|
|
||||||
|
# Frontend build.
|
||||||
|
- uses: pnpm/action-setup@v4.1.0
|
||||||
|
with:
|
||||||
|
version: 10
|
||||||
|
- uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "22"
|
||||||
|
cache: pnpm
|
||||||
|
cache-dependency-path: "web/pnpm-lock.yaml"
|
||||||
|
- run: pnpm install
|
||||||
|
working-directory: web
|
||||||
|
- name: Run frontend build
|
||||||
|
run: pnpm release
|
||||||
|
working-directory: web
|
||||||
|
|
||||||
- name: Build and Push
|
- name: Build and Push
|
||||||
id: docker_build
|
id: docker_build
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./scripts/Dockerfile
|
file: ./scripts/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: ${{ env.DOCKER_PLATFORMS }}
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue