fix(图像格式转换): 去除临时文件中的原文件名,错把临时文件名上传给存储空间了 #54
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: Docker | |
on: | |
push: | |
branches: '*' | |
tags: '*' | |
paths: | |
- '.github/**' | |
- 'src/**' | |
- '.gitmodules' | |
- 'lsky-pro' | |
pull_request: | |
branches: "main" | |
paths: | |
- '.github/**' | |
- 'src/**' | |
- '.gitmodules' | |
- 'lsky-pro' | |
env: | |
IMAGE_NAME: ${{ github.actor }}/lsky-pro | |
LOWERCASE_IMAGE_NAME: "" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
# This is used to complete the identity challenge | |
# with sigstore/fulcio when running outside of PRs. | |
id-token: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Update Submodule | |
run: git submodule update --init --recursive | |
- name: Composer Install | |
uses: php-actions/composer@v6 | |
with: | |
php_version: "8.1" | |
working_dir: "lsky-pro" | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Convert IMAGE_NAME to lowercase | |
run: | | |
IMAGE_NAME=${{ env.IMAGE_NAME }} | |
echo "LOWERCASE_IMAGE_NAME=${IMAGE_NAME,,}" >> $GITHUB_ENV | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Log in to Docker Hub | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: src/Dockerfile | |
push: true | |
tags: ghcr.io/${{ env.LOWERCASE_IMAGE_NAME }}:${{ github.ref_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
# 发布tag时推送到dockerhub | |
- name: Push Docker image to Docker Hub (on tag push) | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: src/Dockerfile | |
push: true | |
tags: | | |
${{ env.LOWERCASE_IMAGE_NAME }}:latest | |
${{ env.LOWERCASE_IMAGE_NAME }}:${{ github.ref_name }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |