Update dashboard.yml #208
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build Dashboard Image And Push | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- "v*" | |
branches: | |
- "master" | |
paths-ignore: | |
- "cmd/playground/**" | |
- "cmd/agent/**" | |
- "script/**" | |
- "*.md" | |
- ".*" | |
- ".github/workflows/agent.yml" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Fetch IPInfo GeoIP Database | |
env: | |
IPINFO_TOKEN: ${{ secrets.IPINFO_TOKEN }} | |
run: | | |
rm pkg/geoip/geoip.db | |
wget -O pkg/geoip/geoip.db https://ipinfo.io/data/free/country.mmdb?token=${IPINFO_TOKEN} | |
- name: Extract branch name | |
run: | | |
export TAG_NAME=$(echo ${GITHUB_REF#refs/tags/}) | |
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: xgo build | |
uses: crazy-max/ghaction-xgo@v2 | |
with: | |
xgo_version: latest | |
go_version: 1.21.x | |
dest: dist | |
pkg: cmd/dashboard | |
prefix: dashboard | |
targets: linux/amd64,linux/arm64,linux/arm-7,linux/s390x,linux/riscv64,windows/amd64,windows/386,windows/arm64 # linux/386, | |
v: true | |
x: false | |
race: false | |
tags: timetzdata | |
ldflags: -s -w --extldflags '-static -fpic' -X github.com/xos/serverstatus/service/singleton.Version=${{ steps.extract_branch.outputs.tag }} | |
buildmode: default | |
- name: Log in to the GHCR | |
uses: docker/login-action@master | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Login To Docker Hub | |
uses: docker/login-action@master | |
with: | |
username: ${{ secrets.DOC_USER }} | |
password: ${{ secrets.DOC_PAT }} | |
- name: Log in to the AliyunCS | |
uses: docker/login-action@master | |
with: | |
registry: registry.cn-shanghai.aliyuncs.com | |
username: ${{ secrets.ALI_USER }} | |
password: ${{ secrets.ALI_PAT }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Set up image name | |
run: | | |
GHRC_IMAGE_NAME=$(echo "ghcr.io/${{ github.repository_owner }}/server-dash" | tr '[:upper:]' '[:lower:]') | |
DOC_IMAGE_NAME=$(echo "nangle/server-dash" | tr '[:upper:]' '[:lower:]') | |
if [ ${{ github.repository_owner }} = "xOS" ] | |
then ALI_IMAGE_NAME=$(echo "registry.cn-shanghai.aliyuncs.com/dns/server-dash") | |
else ALI_IMAGE_NAME=$(echo "registry.cn-shanghai.aliyuncs.com/${{ github.repository_owner }}/server-dash" | tr '[:upper:]' '[:lower:]') | |
fi | |
echo "::set-output name=GHRC_IMAGE_NAME::$GHRC_IMAGE_NAME" | |
echo "::set-output name=ALI_IMAGE_NAME::$ALI_IMAGE_NAME" | |
echo "::set-output name=DOC_IMAGE_NAME::$DOC_IMAGE_NAME" | |
id: image-name | |
- name: Build Dasbboard Image And Push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./Dockerfile | |
platforms: linux/amd64,linux/arm64,linux/arm,linux/s390x,linux/riscv64 # linux/386, | |
push: true | |
tags: | | |
${{ steps.image-name.outputs.GHRC_IMAGE_NAME }}:latest | |
${{ steps.image-name.outputs.GHRC_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: Compress dist files | |
run: | | |
for file in dist/*; do | |
if [ -f "$file" ]; then | |
zip -r "$file.zip" "$file" | |
fi | |
done | |
- name: Release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "dist/*.zip" | |
generateReleaseNotes: true | |
- name: Purge jsdelivr cache | |
run: | | |
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/serverstatus@master/script/server-status.sh | |
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/serverstatus@master/script/server-agent.service | |
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/serverstatus@master/script/docker-compose.yaml | |
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/serverstatus@master/script/config.yaml | |
LOWER_USERNAME=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]') | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/script/server-status.sh | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/script/server-agent.service | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/script/docker-compose.yaml | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/script/config.yaml | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/resource/static/bg/background.jpeg | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/resource/static/favicon.ico | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/resource/static/logo.png | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/resource/static/main.css | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/resource/static/main.js | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/resource/static/semantic-ui-alerts.min.css | |
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/serverstatus@master/resource/static/semantic-ui-alerts.min.js |