Skip to content

Commit

Permalink
fix: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
DVKunion committed Apr 2, 2024
1 parent ddec7d8 commit 4ce2a7b
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 34 deletions.
5 changes: 2 additions & 3 deletions .github/conf/.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
before:
hooks:
- go mod tidy
-
builds:
- binary: seamoon
env:
Expand All @@ -15,14 +14,14 @@ builds:
- 6
- 7
ldflags:
- -s -w -X github.com/DVKunion/SeaMoon/system/xlog.Version={{.Version}} -X github.com/DVKunion/SeaMoon/system/xlog.Commit={{.Sha}}
- -s -w -X github.com/DVKunion/SeaMoon/system/xlog.Version={{.Version}} -X github.com/DVKunion/SeaMoon/system/xlog.Commit={{.ShortCommit}}
checksum:
name_template: 'checksums.txt'
snapshot:
name_template: "{{ .Tag }}-next"
upx:
- enabled: true
goos: [linux, darwin]
goos: [ linux, darwin ]
compress: best
changelog:
sort: asc
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
name: SeaMoon

name: seamoon-build
on:
push:
tags:
- "*"
pull_request:
branches: [ "main" ]
workflow_call:

jobs:
build:
Expand Down
91 changes: 77 additions & 14 deletions .github/workflows/package.yaml → .github/workflows/package.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
name: Package
name: seamoon-package
on:
push:
tags:
- "*"
workflow_call:
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
ALIYUN_USERNAME:
required: true
ALIYUN_PASSWORD:
required: true
TENCENT_USERNAME:
required: true
TENCENT_PASSWORD:
required: true

jobs:
package-docker:
Expand All @@ -14,8 +25,36 @@ jobs:
include:
- registry: docker.io
repo: dvkunion/seamoon
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
name: login ${{ matrix.registry }}
with:
registry: ${{ matrix.registry }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v5
with:
push: true
platforms: |
linux/amd64
linux/arm64
linux/386
tags: |
${{ matrix.registry }}/${{ matrix.repo }}:latest
${{ matrix.registry }}/${{ matrix.repo }}:${{github.ref_name}}
build-args: |
VERSION=${{github.ref_name}}
context: ./
package-aliyun:
name: package-aliyun
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
include:
- registry: [
registry.cn-hangzhou.aliyuncs.com,
registry.cn-shanghai.aliyuncs.com,
Expand All @@ -38,8 +77,36 @@ jobs:
registry.us-east-1.aliyuncs.com,
]
repo: seamoon/seamoon
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PASSWORD }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
name: login ${{ matrix.registry }}
with:
registry: ${{ matrix.registry }}
username: ${{ secrets.ALIYUN_USERNAME }}
password: ${{ secrets.ALIYUN_PASSWORD }}
- uses: docker/build-push-action@v5
with:
push: true
platforms: |
linux/amd64
linux/arm64
linux/386
tags: |
${{ matrix.registry }}/${{ matrix.repo }}:latest
${{ matrix.registry }}/${{ matrix.repo }}:${{github.ref_name}}
build-args: |
VERSION=${{github.ref_name}}
context: ./
package-tencent:
name: package-tecent
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/')
strategy:
matrix:
include:
- registry: [
hkccr.ccs.tencentyun.com,
inccr.ccs.tencentyun.com,
Expand All @@ -52,14 +119,10 @@ jobs:
uswccr.ccs.tencentyun.com,
]
repo: seamoon/seamoon
username: ${{ secrets.TENCENT_USERNAME }}
password: ${{ secrets.TENCENT_PASSWORD }}
- registry: [
ccr.ccs.tencentyun.com,
]
repo: dvkunion/seamoon
username: ${{ secrets.TENCENT_USERNAME }}
password: ${{ secrets.TENCENT_PASSWORD }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
Expand All @@ -68,8 +131,8 @@ jobs:
name: login ${{ matrix.registry }}
with:
registry: ${{ matrix.registry }}
username: ${{ matrix.username }}
password: ${{ matrix.password }}
username: ${{ secrets.TENCENT_USERNAME }}
password: ${{ secrets.TENCENT_PASSWORD }}
- uses: docker/build-push-action@v5
with:
push: true
Expand Down
7 changes: 3 additions & 4 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy

name: seamoon-package
on:
push:
branches: [ "main", "feat/docs" ]
workflow_call:

jobs:
# Single deploy job since we're just deploying
deploy:
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
name: goreleaser

name: seamoon-goreleaser
on:
push:
tags:
- "*"

workflow_call:
secrets:
GO_RELEASER_GITHUB_TOKEN:
required: true
jobs:
build:
name: GoReleaser build
Expand All @@ -14,6 +13,13 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build Front
run: |
cd web && npm install | true && npm run build && cp -r dist ../cmd/client/static
- name: Set up Go
uses: actions/setup-go@v5
with:
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/seamoon.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: seamoon
on: [ push, pull_request ]
jobs:
build:
uses: ./.github/workflows/build.yml
docs:
if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/feat/docs' }}
uses: ./.github/workflows/pages.yml
release:
if: startsWith(github.ref, 'refs/tags/')
uses: ./.github/workflows/release.yml
secrets:
GO_RELEASER_GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}
package:
if: startsWith(github.ref, 'refs/tags/')
uses: ./.github/workflows/package.yml
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
ALIYUN_USERNAME: ${{ secrets.ALIYUN_USERNAME }}
ALIYUN_PASSWORD: ${{ secrets.ALIYUN_PASSWORD }}
TENCENT_USERNAME: ${{ secrets.TENCENT_USERNAME }}
TENCENT_PASSWORD: ${{ secrets.TENCENT_PASSWORD }}

0 comments on commit 4ce2a7b

Please sign in to comment.