diff --git a/.github/workflows/Nightly-Image.yml b/.github/workflows/Nightly-Image.yml index 812ca8379..6d83ab168 100644 --- a/.github/workflows/Nightly-Image.yml +++ b/.github/workflows/Nightly-Image.yml @@ -1,28 +1,49 @@ -name: Nightly-Image-Build - -defaults: - run: - shell: bash - +name: Build Nightly Image on: - workflow_call: + schedule: + # Schedule execution at midnight every day (00:00) + - cron: "0 0 * * *" + push: + branches: + - main + workflow_dispatch: + # Allows you to manually trigger 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'] - + php_version: [ 7.4, 8.1, latest ] steps: - - name: "Checkout code" - uses: actions/checkout@v4 + # Checkout the repository + - name: Checkout repository + uses: actions/checkout@v3 + with: + ref: main + + # 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:latest - - name: "Build Nightly Image" - run: | - echo "Publish each updated content to the nightly mirror, package and fix errors in time." \ No newline at end of file + # Logout from Docker Hub + - name: Log out from Docker Hub + run: docker logout \ No newline at end of file