Skip to content

更新 index.js

更新 index.js #40

Workflow file for this run

name: Build Waline image
on:
push:
pull_request:
jobs:
build:
name: Build Waline image
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Pack webhook plugin
run: |
cd waline-plugin-webhook
npm pack
mv waline-plugin-webhook-*.tgz ../
- name: Set Docker image tag
id: set-tag
run: |
SHORT_SHA=${{ github.sha }}
SHORT_SHA=${SHORT_SHA:0:7} # 获取Git提交哈希的简写
echo "IMAGE_NAME=waline" >> $GITHUB_OUTPUT
echo "TAGS=tbeducn/waline:$SHORT_SHA,tbeducn/waline:latest" >> $GITHUB_OUTPUT
- name: Set up Docker QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check for required secrets
shell: bash
run: |
echo "Checking if DOCKER secrets are provided..."
if [ -z "${{ secrets.DOCKER_USERNAME }}" ]; then
echo "Error: DOCKER_USERNAME secret is required"
exit 1
fi
if [ -z "${{ secrets.DOCKER_PASSWORD }}" ]; then
echo "Error: DOCKER_PASSWORD secret is required"
exit 1
fi
echo "Secrets are provided"
echo "Registry: Docker Hub"
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Waline image
uses: docker/build-push-action@v6.14.0
with:
context: .
file: waline/Dockerfile
push: true
tags: ${{ steps.set-tag.outputs.TAGS }}
platforms: linux/amd64