try fix cloudflare'problem #2
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: LLMER-BPD-Actions (Main Branch) | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-push-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set image tag | |
id: tags | |
run: | | |
TIMESTAMP=$(date +%Y%m%d%H%M%S) | |
SHORT_SHA=$(git rev-parse --short HEAD) | |
IMAGE_TAG="latest" | |
UNIQUE_TAG="${TIMESTAMP}-${SHORT_SHA}" | |
echo "DOCKER_HUB_TAG=${{ secrets.DOCKER_IMAGE_NAME }}/llmer:${IMAGE_TAG}" >> $GITHUB_ENV | |
echo "DOCKER_HUB_UNIQUE_TAG=${{ secrets.DOCKER_IMAGE_NAME }}/llmer:${UNIQUE_TAG}" >> $GITHUB_ENV | |
- name: Build and publish image | |
run: | | |
docker buildx build \ | |
-f Dockerfile \ | |
--platform linux/amd64 \ | |
--label "org.opencontainers.image.source=https://github.com/${{ github.repository }}" \ | |
--label "org.opencontainers.image.description=LLmer image" \ | |
--push \ | |
--tag ${{ env.DOCKER_HUB_TAG }} \ | |
--tag ${{ env.DOCKER_HUB_UNIQUE_TAG }} \ | |
. | |
- name: Deploy to main server | |
uses: appleboy/ssh-action@v1.1.0 | |
with: | |
host: ${{ secrets.MAIN_HOST }} | |
port: ${{ secrets.MAIN_PORT }} | |
username: ${{ secrets.MAIN_SSH_USER }} | |
key: ${{ secrets.MAIN_ID_RSA }} | |
script: | | |
compose-operation -p ${{ secrets.MAIN_DEPLOY_PATH }} |