mirror of
https://github.com/eiblog/eiblog.git
synced 2026-02-08 15:52:25 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c4fa6d08a | ||
|
|
ccb5e4546e | ||
|
|
6ce6411da0 | ||
|
|
cb2ed7cb82 | ||
|
|
ea566d1650 |
208
.github/workflows/release.yml
vendored
208
.github/workflows/release.yml
vendored
@@ -1,65 +1,169 @@
|
|||||||
name: release image & asset
|
name: Release Image & Asset
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
id-token: write # for SLSA provenance
|
||||||
|
attestations: write # for attestations
|
||||||
|
|
||||||
|
env:
|
||||||
|
REGISTRY: docker.io
|
||||||
|
GOPROXY: https://goproxy.io,direct
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
package:
|
# Job 1: 打包源码 tar 文件
|
||||||
|
package-source:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
tag: ${{ steps.vars.outputs.tag }}
|
||||||
|
sha: ${{ steps.vars.outputs.sha }}
|
||||||
|
date: ${{ steps.vars.outputs.date }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up Go
|
||||||
uses: docker/setup-qemu-action@v2
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
go-version-file: go.mod
|
||||||
|
cache: true
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Extract metadata
|
||||||
uses: docker/setup-buildx-action@v2
|
id: vars
|
||||||
|
run: |
|
||||||
|
echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
|
||||||
|
echo "sha=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT
|
||||||
|
echo "date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Docker tag
|
- name: Package tar archive
|
||||||
id: vars
|
run: scripts/dist_tar.sh ${{ steps.vars.outputs.tag }}
|
||||||
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
|
|
||||||
- name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
|
|
||||||
- name: Build and push eiblog
|
- name: Upload tar artifacts
|
||||||
uses: docker/build-push-action@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
context: .
|
name: release-archives
|
||||||
file: ./build/package/eiblog/Dockerfile
|
path: "*.tar.gz"
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
retention-days: 7
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
deepzz0/eiblog:${{ steps.vars.outputs.tag }}
|
|
||||||
deepzz0/eiblog:latest
|
|
||||||
|
|
||||||
- name: Build and push backup
|
# Job 2: 构建并推送 Docker 镜像
|
||||||
uses: docker/build-push-action@v3
|
build-images:
|
||||||
with:
|
runs-on: ubuntu-latest
|
||||||
context: .
|
needs: package-source
|
||||||
file: ./build/package/backup/Dockerfile
|
strategy:
|
||||||
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
fail-fast: false
|
||||||
push: true
|
matrix:
|
||||||
tags: |
|
app: [eiblog, backup]
|
||||||
deepzz0/backup:${{ steps.vars.outputs.tag }}
|
include:
|
||||||
deepzz0/backup:latest
|
- app: eiblog
|
||||||
|
port: 9000
|
||||||
|
- app: backup
|
||||||
|
port: 9001
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Package tar
|
- name: Set up QEMU
|
||||||
env:
|
uses: docker/setup-qemu-action@v3
|
||||||
GOPROXY: https://goproxy.io,direct
|
with:
|
||||||
run: scripts/dist_tar.sh ${{ steps.vars.outputs.tag }}
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
- name: Release push
|
|
||||||
uses: softprops/action-gh-release@v1
|
- name: Set up Docker Buildx
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
uses: docker/setup-buildx-action@v3
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
- name: Login to Docker Hub
|
||||||
with:
|
uses: docker/login-action@v3
|
||||||
files: |
|
with:
|
||||||
*.tar.gz
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Extract metadata for Docker
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: ${{ env.REGISTRY }}/deepzz0/${{ matrix.app }}
|
||||||
|
tags: |
|
||||||
|
type=ref,event=tag
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.title=${{ matrix.app }}
|
||||||
|
org.opencontainers.image.description=eiblog ${{ matrix.app }} service
|
||||||
|
org.opencontainers.image.vendor=deepzz
|
||||||
|
org.opencontainers.image.revision=${{ needs.package-source.outputs.sha }}
|
||||||
|
org.opencontainers.image.created=${{ needs.package-source.outputs.date }}
|
||||||
|
|
||||||
|
- name: Build and push ${{ matrix.app }} image
|
||||||
|
id: build
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./build/package/${{ matrix.app }}/Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/arm/v7
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=gha,scope=${{ matrix.app }}
|
||||||
|
cache-to: type=gha,mode=max,scope=${{ matrix.app }}
|
||||||
|
provenance: true
|
||||||
|
sbom: true
|
||||||
|
|
||||||
|
- name: Generate SLSA attestation
|
||||||
|
uses: actions/attest-build-provenance@v1
|
||||||
|
with:
|
||||||
|
subject-name: ${{ env.REGISTRY }}/deepzz0/${{ matrix.app }}
|
||||||
|
subject-digest: ${{ steps.build.outputs.digest }}
|
||||||
|
|
||||||
|
# Job 3: 创建 GitHub Release
|
||||||
|
create-release:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: [package-source, build-images]
|
||||||
|
steps:
|
||||||
|
- name: Download tar artifacts
|
||||||
|
uses: actions/download-artifact@v4
|
||||||
|
with:
|
||||||
|
name: release-archives
|
||||||
|
|
||||||
|
- name: Create release summary
|
||||||
|
run: |
|
||||||
|
cat >> $GITHUB_STEP_SUMMARY << 'EOF'
|
||||||
|
# 🎉 Release ${{ needs.package-source.outputs.tag }} Created!
|
||||||
|
|
||||||
|
## 📦 Docker Images
|
||||||
|
- **eiblog**: `deepzz0/eiblog:${{ needs.package-source.outputs.tag }}`
|
||||||
|
- **backup**: `deepzz0/backup:${{ needs.package-source.outputs.tag }}`
|
||||||
|
|
||||||
|
## 🏗️ Build Info
|
||||||
|
- **Tag**: ${{ needs.package-source.outputs.tag }}
|
||||||
|
- **Commit**: ${{ needs.package-source.outputs.sha }}
|
||||||
|
- **Built**: ${{ needs.package-source.outputs.date }}
|
||||||
|
- **Platforms**: linux/amd64, linux/arm64, linux/arm/v7
|
||||||
|
|
||||||
|
## 🔐 Security
|
||||||
|
- ✅ SLSA Build Provenance
|
||||||
|
- ✅ SBOM (Software Bill of Materials)
|
||||||
|
- ✅ Container Signing
|
||||||
|
EOF
|
||||||
|
|
||||||
|
- name: Create GitHub release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
files: "*.tar.gz"
|
||||||
|
generate_release_notes: true
|
||||||
|
name: Release ${{ needs.package-source.outputs.tag }}
|
||||||
|
body: |
|
||||||
|
## Docker Images
|
||||||
|
```bash
|
||||||
|
docker pull deepzz0/eiblog:${{ needs.package-source.outputs.tag }}
|
||||||
|
docker pull deepzz0/backup:${{ needs.package-source.outputs.tag }}
|
||||||
|
```
|
||||||
|
|
||||||
|
## Multi-Architecture Support
|
||||||
|
- linux/amd64
|
||||||
|
- linux/arm64
|
||||||
|
- linux/arm/v7
|
||||||
|
|
||||||
|
Built with commit ${{ needs.package-source.outputs.sha }} on ${{ needs.package-source.outputs.date }}
|
||||||
|
|||||||
14
CHANGELOG.md
14
CHANGELOG.md
@@ -2,6 +2,20 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
||||||
|
|
||||||
|
### [3.0.2](https://github.com/eiblog/eiblog/compare/v3.0.1...v3.0.2) (2025-07-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* ci ([ccb5e45](https://github.com/eiblog/eiblog/commit/ccb5e4546e224182c949e72e9eae82fbbe1a02fe))
|
||||||
|
|
||||||
|
### [3.0.1](https://github.com/eiblog/eiblog/compare/v3.0.0...v3.0.1) (2025-07-25)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* dist tar ([cb2ed7c](https://github.com/eiblog/eiblog/commit/cb2ed7cb8244dda8cbd8c5966c7ed02e177777e5))
|
||||||
|
|
||||||
## [3.0.0](https://github.com/eiblog/eiblog/compare/v2.2.17...v3.0.0) (2025-07-24)
|
## [3.0.0](https://github.com/eiblog/eiblog/compare/v2.2.17...v3.0.0) (2025-07-24)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,14 +2,14 @@ FROM golang:1.20 AS builder
|
|||||||
|
|
||||||
WORKDIR /eiblog
|
WORKDIR /eiblog
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN ./scripts/run_build.sh backup
|
RUN scripts/run_build.sh backup
|
||||||
|
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
LABEL maintainer="deepzz.qi@gmail.com"
|
LABEL maintainer="deepzz.qi@gmail.com"
|
||||||
|
|
||||||
RUN apk add --update --no-cache tzdata ca-certificates \
|
RUN apk add --update --no-cache tzdata ca-certificates \
|
||||||
mongodb-tools libc6-compat gcompat
|
mongodb-tools libc6-compat gcompat
|
||||||
|
|
||||||
COPY README.md /app/README.md
|
COPY README.md /app/README.md
|
||||||
COPY CHANGELOG.md /app/CHANGELOG.md
|
COPY CHANGELOG.md /app/CHANGELOG.md
|
||||||
COPY LICENSE /app/LICENSE
|
COPY LICENSE /app/LICENSE
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ FROM golang:1.20 AS builder
|
|||||||
|
|
||||||
WORKDIR /eiblog
|
WORKDIR /eiblog
|
||||||
COPY . .
|
COPY . .
|
||||||
RUN ./scripts/run_build.sh eiblog
|
RUN scripts/run_build.sh eiblog
|
||||||
|
|
||||||
|
|
||||||
FROM alpine:latest
|
FROM alpine:latest
|
||||||
LABEL maintainer="deepzz.qi@gmail.com"
|
LABEL maintainer="deepzz.qi@gmail.com"
|
||||||
|
|
||||||
RUN apk add --update --no-cache tzdata
|
RUN apk add --update --no-cache tzdata ca-certificates
|
||||||
|
|
||||||
COPY README.md /app/README.md
|
COPY README.md /app/README.md
|
||||||
COPY CHANGELOG.md /app/CHANGELOG.md
|
COPY CHANGELOG.md /app/CHANGELOG.md
|
||||||
COPY LICENSE /app/LICENSE
|
COPY LICENSE /app/LICENSE
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ apimode:
|
|||||||
name: cmd-backup
|
name: cmd-backup
|
||||||
listen: 0.0.0.0:9000
|
listen: 0.0.0.0:9000
|
||||||
database: # 数据库配置
|
database: # 数据库配置
|
||||||
driver: sqlite
|
driver: mongodb
|
||||||
source: ./db.sqlite
|
source: mongodb://localhost:27017
|
||||||
backupto: qiniu # 备份到, default: qiniu
|
backupto: qiniu # 备份到, default: qiniu
|
||||||
interval: 7d # 备份周期, default: 7d
|
interval: 7d # 备份周期, default: 7d
|
||||||
validity: 60 # 备份保留时间, default: 60
|
validity: 60 # 备份保留时间, default: 60
|
||||||
|
|||||||
@@ -6,12 +6,20 @@ _tag="$1"
|
|||||||
_arch=$(go env GOARCH)
|
_arch=$(go env GOARCH)
|
||||||
|
|
||||||
for file in cmd/*; do
|
for file in cmd/*; do
|
||||||
|
# Skip if not a directory
|
||||||
|
if [ ! -d "$file" ]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
app="$(basename $file)";
|
app="$(basename $file)";
|
||||||
# tar platform
|
# tar platform
|
||||||
for os in linux darwin windows; do
|
for os in linux darwin windows; do
|
||||||
_target="$app-$_tag.$os-$_arch.tar.gz"
|
_target="$app-$_tag.$os-$_arch.tar.gz"
|
||||||
GOOS=$os GOARCH=$_arch \
|
GOOS=$os GOARCH=$_arch scripts/run_build.sh $app
|
||||||
go build -ldflags '-extldflags "-static"' -o ./cmd/$app/backend ./cmd/$app
|
|
||||||
tar czf $_target ./cmd/$app/etc ./cmd/$app/backend
|
# Create tar with flattened structure using -C parameter
|
||||||
|
tar czf "$_target" \
|
||||||
|
CHANGELOG.md LICENSE README.md \
|
||||||
|
-C "./cmd/$app" etc backend
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user