-
Notifications
You must be signed in to change notification settings - Fork 163
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
69 additions
and
13 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,84 @@ | ||
name: Nightly-Image-Build | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
name: Build Nightly Image | ||
|
||
on: | ||
pull_request_target: | ||
workflow_call: | ||
inputs: | ||
php_version: | ||
description: "PHP version to use for the build" | ||
required: false | ||
default: "latest" | ||
type: string | ||
|
||
schedule: | ||
- cron: "0 0 * * *" | ||
push: | ||
branches: | ||
- master | ||
workflow_dispatch: | ||
|
||
jobs: | ||
Nightly-Image-Build: | ||
name: Nightly-Image-${{ matrix.arch }}-PHP${{ matrix.php-versions }} | ||
build-and-push: | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
strategy: | ||
matrix: | ||
php-versions: ['8.1'] | ||
arch: ['x64', 'aarch64'] | ||
include: | ||
- php_version: ${{ inputs.php_version }} | ||
|
||
steps: | ||
- name: "Checkout code" | ||
uses: actions/checkout@v4 | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: "Build Nightly Image" | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
# Debugging steps for DOCKER_USERNAME | ||
- name: Verify DOCKER_USERNAME is set | ||
run: | | ||
if [ -z "$DOCKER_USERNAME" ]; then | ||
echo "DOCKER_USERNAME is empty or not set!" | ||
exit 1 | ||
else | ||
echo "DOCKER_USERNAME is set." | ||
fi | ||
- name: Output partial DOCKER_USERNAME | ||
run: | | ||
echo "Partial DOCKER_USERNAME: ${DOCKER_USERNAME:0:3}***" | ||
- name: Debug DOCKER_USERNAME length | ||
run: | | ||
echo "Publish each updated content to the nightly mirror, package and fix errors in time." | ||
echo "Length of DOCKER_USERNAME: ${#DOCKER_USERNAME}" | ||
- name: Encode and Debug DOCKER_USERNAME | ||
run: | | ||
echo "Encoded DOCKER_USERNAME: $(echo -n "$DOCKER_USERNAME" | base64)" | ||
- name: Log Environment Variables | ||
run: env | ||
|
||
- name: Log in to Docker Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: linux/amd64,linux/arm64 | ||
file: ./docker/Dockerfile | ||
push: true | ||
tags: cypht/cypht-nightly:${{ matrix.php_version }} | ||
debug: true | ||
|
||
- name: Log out from Docker Hub | ||
run: docker logout |