mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-22 12:48: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 }}
|
||||
GOARCH: ${{ matrix.goarch }}
|
||||
GOARM: ${{ matrix.goarm }}
|
||||
outputs:
|
||||
tag_name: ${{ steps.extract_branch.outputs.tag }}
|
||||
steps:
|
||||
- run: git config --global --add safe.directory /__w/nezha/nezha
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Fetch IPInfo GeoIP Database
|
||||
if: github.event_name == 'push'
|
||||
env:
|
||||
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }}
|
||||
run: |
|
||||
@ -46,14 +43,28 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: "1.23.x"
|
||||
|
||||
- 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
|
||||
- name: Build with tag
|
||||
if: contains(github.ref, 'refs/tags/')
|
||||
uses: goreleaser/goreleaser-action@v6
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: '~> v2'
|
||||
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
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
@ -83,7 +94,6 @@ jobs:
|
||||
done
|
||||
|
||||
- name: Release
|
||||
if: contains(github.ref, 'refs/tags/')
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
artifacts: "assets/*/*/*.zip"
|
||||
@ -102,7 +112,6 @@ jobs:
|
||||
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/config.yaml
|
||||
|
||||
- name: Trigger sync
|
||||
if: contains(github.ref, 'refs/tags/')
|
||||
env:
|
||||
GH_REPO: ${{ github.repository }}
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
@ -117,6 +126,12 @@ jobs:
|
||||
name: Release Docker images
|
||||
steps:
|
||||
- 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
|
||||
uses: actions/download-artifact@v4
|
||||
@ -128,27 +143,16 @@ jobs:
|
||||
chmod -R +x ./assets/*
|
||||
mkdir 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
|
||||
if: contains(github.ref, 'refs/tags/')
|
||||
run: |
|
||||
export TAG_NAME=$(echo ${GITHUB_REF#refs/tags/})
|
||||
if [ -z "$TAG_NAME" ]; then
|
||||
export TAG_NAME=$(echo ${GITHUB_REF#refs/heads/})
|
||||
fi
|
||||
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
|
||||
id: extract_branch
|
||||
|
||||
- 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
|
||||
id: extract_branch
|
||||
|
||||
- name: Log into GHCR
|
||||
uses: docker/login-action@master
|
||||
with:
|
||||
@ -180,7 +184,8 @@ jobs:
|
||||
echo "ALI_IMAGE_NAME=$ALI_IMAGE_NAME" >> $GITHUB_OUTPUT
|
||||
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
|
||||
with:
|
||||
context: .
|
||||
@ -192,3 +197,15 @@ jobs:
|
||||
${{ 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 }}:${{ 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