fix: update github workflow
This commit is contained in:
30
.github/workflows/build.yaml
vendored
30
.github/workflows/build.yaml
vendored
@@ -1,30 +0,0 @@
|
|||||||
name: Build
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'main'
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: self-hosted
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v3
|
|
||||||
-
|
|
||||||
name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
-
|
|
||||||
name: Login to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
-
|
|
||||||
name: Build and push
|
|
||||||
uses: docker/build-push-action@v5
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
tags: smallbuster/request-bot:latest
|
|
||||||
55
.github/workflows/main.yaml
vendored
Normal file
55
.github/workflows/main.yaml
vendored
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
name: Build and deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'main'
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: self-hosted
|
||||||
|
steps:
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v3
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
- name: Build and push
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
push: true
|
||||||
|
tags: smallbuster/request-bot:latest
|
||||||
|
deploy:
|
||||||
|
runs-on: self-hosted
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Pull Docker image from Docker Hub
|
||||||
|
run: |
|
||||||
|
sudo docker pull smallbuster/request-bot:latest
|
||||||
|
|
||||||
|
- name: Stop and remove existing container
|
||||||
|
run: |
|
||||||
|
sudo docker stop request-bot || true && docker rm request-bot || true
|
||||||
|
|
||||||
|
- name: Run Docker container
|
||||||
|
run: |
|
||||||
|
docker run -d -restart=always \
|
||||||
|
-e EMAIL_ADDRESS=${{secrets.EMAIL_ADDRESS}} \
|
||||||
|
-e EMAIL_PASSWORD=${{secrets.EMAIL_PASSWORD}} \
|
||||||
|
-e EMAIL_IMAP_SERVER=${{secrets.EMAIL_IMAP_SERVER}} \
|
||||||
|
-e EMAIL_IMAP_SERVER_PORT=${{secrets.EMAIL_IMAP_SERVER_PORT}} \
|
||||||
|
-e TELEGRAM_BOT_TOKEN=${{secrets.TELEGRAM_BOT_TOKEN}} \
|
||||||
|
-e TELEGRAM_GROUP_ID=${{secrets.TELEGRAM_GROUP_ID}} \
|
||||||
|
-e MARK_STRING=${{secrets.MARK_STRING}} \
|
||||||
|
--name request-bot smallbuster/request-bot:latest
|
||||||
Reference in New Issue
Block a user