docker-firefox/.github/workflows/build-image.yml
wood chen 9e7c32b6e8 ci: 移除GitHub配置文件并简化CI工作流
移除不再使用的GitHub配置文件,包括ISSUE_TEMPLATE和FUNDING.yml。同时,简化了CI工作流,移除了与版本标签相关的复杂逻辑,并将Docker镜像名称更改为woodchen/firefox。此外,将构建环境更新为ubuntu-latest,并优化了构建步骤。
2025-03-20 18:12:19 +08:00

75 lines
1.9 KiB
YAML

name: Docker image CI/CD
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DOCKER_IMAGE_NAME: woodchen/firefox
PLATFORMS: linux/amd64,linux/386,linux/arm/v7,linux/arm64/v8
on:
push:
branches: '*'
pull_request:
jobs:
build:
name: Build image
runs-on: ubuntu-latest
steps:
- name: Free disk space
uses: jlumbroso/free-disk-space@main
with:
tool-cache: true
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: false
- name: Prepare
id: prep
run: |
# Set Docker container tag to latest
TAGS="${{ env.DOCKER_IMAGE_NAME }}:latest"
# Print results.
echo "::group::Results"
echo "Github reference: $GITHUB_REF"
echo "Docker container tag(s): $TAGS"
echo "::endgroup::"
# Export outputs.
echo "tags=${TAGS}" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm,arm64,ppc64le,mips64,s390x
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
if: github.ref == 'refs/heads/main'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
push: github.ref == 'refs/heads/main'
platforms: ${{ env.PLATFORMS }}
tags: ${{ steps.prep.outputs.tags }}
cache-from: type=gha,scope=${{ env.DOCKER_IMAGE_NAME }}
cache-to: type=gha,mode=max,scope=${{ env.DOCKER_IMAGE_NAME }}