50 lines
1.7 KiB
YAML
50 lines
1.7 KiB
YAML
name: Build TGExporter
|
|
run-name: ${{ gitea.actor }} Build TGExporter
|
|
on: [push]
|
|
|
|
jobs:
|
|
Build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check out repository code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Install dependencies and build frontend
|
|
run: |
|
|
cd frontend
|
|
npm config set registry https://npm.hub.ipao.vip
|
|
npm install
|
|
npm run build
|
|
|
|
- name: Set up Go
|
|
uses: actions/setup-go@v3
|
|
with:
|
|
go-version: "1.22"
|
|
|
|
- name: Build Go application
|
|
run: |
|
|
mkdir -p build
|
|
go env -w GOPROXY=https://go.hub.ipao.vip,direct
|
|
go build -o build/exporter .
|
|
|
|
- name: Build final Docker image
|
|
run: |
|
|
echo 'FROM docker.hub.ipao.vip/alpine:3.20' > Dockerfile
|
|
echo 'COPY config.yml /root/.exporter.yml' >> Dockerfile
|
|
echo 'COPY build/exporter /usr/local/bin/exporter' >> Dockerfile
|
|
echo 'WORKDIR /root' >> Dockerfile
|
|
echo 'ENTRYPOINT ["/usr/local/bin/exporter"]' >> Dockerfile
|
|
echo 'CMD [ "serve" ]' >> Dockerfile
|
|
docker login -u ${{ secrets.DOCKER_AF_USERNAME }} -p ${{ secrets.DOCKER_AF_PASSWORD }} docker-af.hub.ipao.vip
|
|
docker build --push -t docker-af.hub.ipao.vip/rogeecn/tg-exporter:latest .
|
|
|
|
# curl -kL https://portainer.ipao.vip/api/stacks/webhooks/178f9e9d-6700-40b3-9f2f-364fd273deab --data {}
|
|
- name: Notify Portainer to update stack
|
|
run: |
|
|
curl -kL https://portainer.ipao.vip/api/stacks/webhooks/178f9e9d-6700-40b3-9f2f-364fd273deab --data {}
|