mirror of
https://github.com/woodchen-ink/docker-firefox.git
synced 2025-07-18 05:42:00 +08:00
74 lines
1.8 KiB
YAML
74 lines
1.8 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
|
|
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: true
|
|
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 }}
|