nezha/.github/workflows/dashboard.yml

52 lines
2.3 KiB
YAML
Raw Normal View History

2020-11-29 09:23:00 -05:00
name: Dashboard image
2020-11-06 07:51:23 -05:00
2020-11-29 09:17:40 -05:00
on:
push:
2020-11-29 09:27:26 -05:00
branches:
- "master"
2020-11-29 09:17:40 -05:00
paths-ignore:
- "cmd/playground/**"
2020-11-29 09:17:40 -05:00
- "cmd/agent/**"
- "script/**"
- "*.md"
2021-01-29 19:57:17 -05:00
- ".*"
2020-11-06 07:51:23 -05:00
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
2020-11-11 09:21:16 -05:00
- name: Log into registry
2021-04-11 08:14:47 -04:00
run: |
2021-04-11 08:13:34 -04:00
echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
echo "${{ secrets.ALI_PAT }}" | docker login registry.cn-shanghai.aliyuncs.com -u ${{ secrets.ALI_USER }} --password-stdin
2020-11-11 09:21:16 -05:00
2021-04-11 08:13:34 -04:00
- name: Build dasbboard image
2020-11-06 07:51:23 -05:00
run: |
2021-04-03 13:28:59 -04:00
go env
2020-12-30 08:28:57 -05:00
go test -v ./...
2021-04-11 08:13:34 -04:00
docker build -t nezha-dasbboard -f Dockerfile .
- name: Push dasbboard image
run: |
GHRC_IMAGE_NAME=$(echo "ghcr.io/${{ github.repository_owner }}/nezha-dashboard" | tr '[:upper:]' '[:lower:]')
2021-04-11 09:59:33 -04:00
if [ ${{ github.repository_owner }} = "naiba" ]
then ALI_IMAGE_NAME=$(echo "registry.cn-shanghai.aliyuncs.com/naibahq/nezha-dashboard")
else ALI_IMAGE_NAME=$(echo "registry.cn-shanghai.aliyuncs.com/${{ github.repository_owner }}/nezha-dashboard" | tr '[:upper:]' '[:lower:]')
fi
2021-04-11 08:13:34 -04:00
docker tag nezha-dasbboard $GHRC_IMAGE_NAME
docker tag nezha-dasbboard $ALI_IMAGE_NAME
docker push $GHRC_IMAGE_NAME
docker push $ALI_IMAGE_NAME
2021-04-11 08:47:33 -04:00
- name: Purge jsdelivr cache
run: |
2021-04-11 09:03:34 -04:00
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/install.sh
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/nezha-agent.service
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/docker-compose.yaml
curl -s https://purge.jsdelivr.net/gh/${{ github.repository_owner }}/nezha@master/script/config.yaml
LOWER_USERNAME=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/install.sh
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/nezha-agent.service
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/docker-compose.yaml
curl -s https://purge.jsdelivr.net/gh/$LOWER_USERNAME/nezha@master/script/config.yaml