mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 20:58:14 -05:00
fix ci
This commit is contained in:
parent
5cf8b8024c
commit
79682034e2
59
.github/workflows/release.yml
vendored
59
.github/workflows/release.yml
vendored
@ -28,14 +28,11 @@ jobs:
|
|||||||
GOOS: ${{ matrix.goos }}
|
GOOS: ${{ matrix.goos }}
|
||||||
GOARCH: ${{ matrix.goarch }}
|
GOARCH: ${{ matrix.goarch }}
|
||||||
GOARM: ${{ matrix.goarm }}
|
GOARM: ${{ matrix.goarm }}
|
||||||
outputs:
|
|
||||||
tag_name: ${{ steps.extract_branch.outputs.tag }}
|
|
||||||
steps:
|
steps:
|
||||||
- run: git config --global --add safe.directory /__w/nezha/nezha
|
- run: git config --global --add safe.directory /__w/nezha/nezha
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Fetch IPInfo GeoIP Database
|
- name: Fetch IPInfo GeoIP Database
|
||||||
if: github.event_name == 'push'
|
|
||||||
env:
|
env:
|
||||||
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }}
|
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
@ -47,13 +44,27 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
go-version: "1.23.x"
|
go-version: "1.23.x"
|
||||||
|
|
||||||
- name: Build
|
- name: bootstrap
|
||||||
|
run: |
|
||||||
|
go install github.com/swaggo/swag/cmd/swag@latest
|
||||||
|
`go env GOPATH`/bin/swag init --pd -d . -g ./cmd/dashboard/main.go -o ./cmd/dashboard/docs --parseGoList=false
|
||||||
|
|
||||||
|
- name: Build with tag
|
||||||
|
if: contains(github.ref, 'refs/tags/')
|
||||||
uses: goreleaser/goreleaser-action@v6
|
uses: goreleaser/goreleaser-action@v6
|
||||||
with:
|
with:
|
||||||
distribution: goreleaser
|
distribution: goreleaser
|
||||||
version: '~> v2'
|
version: '~> v2'
|
||||||
args: build --single-target --clean --skip=validate
|
args: build --single-target --clean --skip=validate
|
||||||
|
|
||||||
|
- name: Build snapshot
|
||||||
|
if: contains(github.ref, 'refs/tags/') == false
|
||||||
|
uses: goreleaser/goreleaser-action@v6
|
||||||
|
with:
|
||||||
|
distribution: goreleaser
|
||||||
|
version: '~> v2'
|
||||||
|
args: build --single-target --clean --skip=validate --snapshot
|
||||||
|
|
||||||
- name: Upload artifacts
|
- name: Upload artifacts
|
||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -83,7 +94,6 @@ jobs:
|
|||||||
done
|
done
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
if: contains(github.ref, 'refs/tags/')
|
|
||||||
uses: ncipollo/release-action@v1
|
uses: ncipollo/release-action@v1
|
||||||
with:
|
with:
|
||||||
artifacts: "assets/*/*/*.zip"
|
artifacts: "assets/*/*/*.zip"
|
||||||
@ -102,7 +112,6 @@ jobs:
|
|||||||
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/config.yaml
|
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/config.yaml
|
||||||
|
|
||||||
- name: Trigger sync
|
- name: Trigger sync
|
||||||
if: contains(github.ref, 'refs/tags/')
|
|
||||||
env:
|
env:
|
||||||
GH_REPO: ${{ github.repository }}
|
GH_REPO: ${{ github.repository }}
|
||||||
GH_TOKEN: ${{ github.token }}
|
GH_TOKEN: ${{ github.token }}
|
||||||
@ -118,6 +127,12 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: prepare frontend dists
|
||||||
|
run: |
|
||||||
|
wget https://github.com/nezhahq/nezha-dashboard/releases/download/v0.0.2/dist.zip
|
||||||
|
unzip dist.zip
|
||||||
|
mv dist admin-dist
|
||||||
|
|
||||||
- name: Download artifacts
|
- name: Download artifacts
|
||||||
uses: actions/download-artifact@v4
|
uses: actions/download-artifact@v4
|
||||||
with:
|
with:
|
||||||
@ -129,23 +144,12 @@ jobs:
|
|||||||
mkdir dist
|
mkdir dist
|
||||||
mv ./assets/*/*/* ./dist
|
mv ./assets/*/*/* ./dist
|
||||||
|
|
||||||
- name: prepare frontend dists
|
|
||||||
run: |
|
|
||||||
wget https://github.com/nezhahq/nezha-dashboard/releases/download/v0.0.2/dist.zip
|
|
||||||
unzip dist.zip
|
|
||||||
mv dist admin-dist
|
|
||||||
|
|
||||||
- name: Extract branch name in tag
|
- name: Extract branch name in tag
|
||||||
if: contains(github.ref, 'refs/tags/')
|
|
||||||
run: |
|
run: |
|
||||||
export TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})
|
export TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})
|
||||||
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
|
if [ -z "$TAG_NAME" ]; then
|
||||||
id: extract_branch
|
export TAG_NAME=$(echo ${GITHUB_REF#refs/heads/})
|
||||||
|
fi
|
||||||
- name: Extract branch name in branch
|
|
||||||
if: not(contains(github.ref, 'refs/tags/'))
|
|
||||||
run: |
|
|
||||||
export TAG_NAME=$(echo ${GITHUB_REF#refs/heads/})
|
|
||||||
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
|
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
|
||||||
id: extract_branch
|
id: extract_branch
|
||||||
|
|
||||||
@ -180,7 +184,8 @@ jobs:
|
|||||||
echo "ALI_IMAGE_NAME=$ALI_IMAGE_NAME" >> $GITHUB_OUTPUT
|
echo "ALI_IMAGE_NAME=$ALI_IMAGE_NAME" >> $GITHUB_OUTPUT
|
||||||
id: image-name
|
id: image-name
|
||||||
|
|
||||||
- name: Build dasbboard image And Push
|
- name: Build dasbboard image And Push with tag
|
||||||
|
if: contains(github.ref, 'refs/tags/')
|
||||||
uses: docker/build-push-action@v5
|
uses: docker/build-push-action@v5
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
@ -192,3 +197,15 @@ jobs:
|
|||||||
${{ steps.image-name.outputs.GHCR_IMAGE_NAME }}:${{ steps.extract_branch.outputs.tag }}
|
${{ steps.image-name.outputs.GHCR_IMAGE_NAME }}:${{ steps.extract_branch.outputs.tag }}
|
||||||
${{ steps.image-name.outputs.ALI_IMAGE_NAME }}:latest
|
${{ steps.image-name.outputs.ALI_IMAGE_NAME }}:latest
|
||||||
${{ steps.image-name.outputs.ALI_IMAGE_NAME }}:${{ steps.extract_branch.outputs.tag }}
|
${{ steps.image-name.outputs.ALI_IMAGE_NAME }}:${{ steps.extract_branch.outputs.tag }}
|
||||||
|
|
||||||
|
- name: Build dasbboard image And Push snapshot
|
||||||
|
if: contains(github.ref, 'refs/tags/') == false
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm64,linux/s390x
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
${{ steps.image-name.outputs.GHCR_IMAGE_NAME }}:${{ steps.extract_branch.outputs.tag }}
|
||||||
|
${{ steps.image-name.outputs.ALI_IMAGE_NAME }}:${{ steps.extract_branch.outputs.tag }}
|
||||||
|
Loading…
Reference in New Issue
Block a user