mirror of
https://github.com/EchoVault/SugarDB.git
synced 2025-12-24 12:57:53 +08:00
120 lines
3.3 KiB
YAML
120 lines
3.3 KiB
YAML
name: goreleaser
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "*"
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
goreleaser:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: '1.21.4'
|
|
- name: Run GoReleaser
|
|
uses: goreleaser/goreleaser-action@v6
|
|
with:
|
|
distribution: goreleaser
|
|
version: ${{ env.GITHUB_REF_NAME }}
|
|
args: release --clean
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GORELEASER_TOKEN }}
|
|
|
|
publish_images:
|
|
name: Publish docker images to multiple registries
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
attestations: write
|
|
id-token: write
|
|
steps:
|
|
- name: Checkout the repo
|
|
uses: actions/checkout@v4
|
|
- name: Login to DockerHub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
- name: Login to the Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
|
|
with:
|
|
images: |
|
|
echovault/echovault
|
|
ghcr.io/${{ github.repository }}
|
|
- name: Build and push Docker images
|
|
id: push
|
|
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile.prod
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
- name: Generate artifact attestation
|
|
uses: actions/attest-build-provenance@v1
|
|
with:
|
|
subject-name: ghcr.io/echovault/echovault
|
|
subject-digest: ${{ steps.push.outputs.digest }}
|
|
push-to-registry: true
|
|
|
|
build_docs:
|
|
name: Build docusaurus documentation
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
- uses: pnpm/action-setup@v4
|
|
name: Install pnpm
|
|
with:
|
|
version: 9
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 18
|
|
cache: pnpm
|
|
cache-dependency-path: ./docs/pnpm-lock.yaml
|
|
- name: Install dependencies
|
|
run: pnpm --prefix docs install
|
|
- name: Build website
|
|
run: pnpm --prefix docs run build
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-pages-artifact@v3
|
|
with:
|
|
path: docs/build
|
|
|
|
publish_docs:
|
|
name: Publish docusaurus docs to GitHub pages
|
|
needs: build_docs
|
|
permissions:
|
|
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
|
|
pages: write # to deploy to Pages
|
|
id-token: write # to verify the deployment originates from an appropriate source
|
|
environment:
|
|
# Deploy to the github-pages environment
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|
|
|
|
|