-
Notifications
You must be signed in to change notification settings - Fork 161
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Fix]Neghtly-Image:correction of the Neghtly-Image file to push code …
…every midnight
- Loading branch information
Showing
1 changed file
with
48 additions
and
16 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,60 @@ | ||
name: Nightly-Image-Build | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
name: Build Nightly Image | ||
|
||
on: | ||
workflow_call: | ||
workflow_call: # Allows this workflow to be called by other workflows | ||
inputs: | ||
php_version: | ||
description: "PHP version to use for the build" | ||
required: false | ||
default: "latest" # Defaults to 'latest' if no version is specified | ||
type: string # Specifies that this input is a string | ||
|
||
schedule: | ||
# Schedule execution at midnight every day (00:00) | ||
- cron: "0 0 * * *" | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
# Allows manual triggering of the workflow | ||
|
||
jobs: | ||
Nightly-Image-Build: | ||
name: Nightly-Image-${{ matrix.arch }}-PHP${{ matrix.php-versions }} | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
php-versions: ['8.1'] | ||
arch: ['x64', 'aarch64'] | ||
include: | ||
- php_version: ${{ inputs.php_version }} # Use the PHP version provided by the calling workflow | ||
|
||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v4 | ||
# Checkout the repository | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Fetch full history to avoid issues with shallow fetch | ||
|
||
# Set up Docker Buildx | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Log in to Docker Hub | ||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
# Build and push the Docker image for linux/amd64 and linux/arm64 | ||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
fetch-depth: 0 | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
file: ./docker/Dockerfile | ||
push: true | ||
tags: ${{ secrets.DOCKER_USERNAME }}/cypht-nightly:${{ matrix.php_version }} | ||
|
||
- name: "Build Nightly Image" | ||
run: | | ||
echo "Publish each updated content to the nightly mirror, package and fix errors in time." | ||
# Log out from Docker Hub | ||
- name: Log out from Docker Hub | ||
run: docker logout |