diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000000..d1ad658013 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,86 @@ +name: phpMyFAQ Nightly Build + +on: + workflow_dispatch: + schedule: + - cron: '0 2 * * *' + +jobs: + run: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + operating-system: ['ubuntu-latest'] + php-versions: ['8.1'] + name: phpMyFAQ Nightly Build + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Get current date + id: date + run: | + echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV + + - name: Get Release name + run: | + echo "release_name=nightly-${{ env.date }}" >> $GITHUB_ENV + + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + tag_prefix: development- + custom_tag: ${{ env.release_name }} + + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: mbstring, curl, fileinfo, filter, gd, json, zip, xml, sqlite3, xdebug, pcov + coverage: xdebug + + - name: Get composer cache directory + id: composer-cache + run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT + + - name: Cache composer dependencies + uses: actions/cache@v3.3.1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install PHP dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader --no-dev + + - name: Set Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + + - name: Install JS dependencies + uses: borales/actions-yarn@v4 + with: + cmd: install + + - name: Run "yarn build" to build frontend production build + uses: borales/actions-yarn@v4 + with: + cmd: build + + - name: Create release artifact + uses: montudor/action-zip@v0.1.0 + with: + args: zip -X -r phpMyFAQ-${{ env.release_name }}.zip phpmyfaq -x "phpmyfaq/src/libs/tecnickcom/tcpdf/fonts/*" + + - name: Update nightly release + uses: softprops/action-gh-release@v1 + with: + prerelease: true + generate_release_notes: false + tag_name: ${{ steps.tag_version.outputs.new_tag }} + files: phpMyFAQ-${{ env.release_name }}.zip