Skip to content

Commit

Permalink
build: added nightly build Github action (#2526)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten committed Jul 2, 2023
1 parent c4363dc commit a5b942e
Showing 1 changed file with 86 additions and 0 deletions.
86 changes: 86 additions & 0 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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/[email protected]
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/[email protected]
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

0 comments on commit a5b942e

Please sign in to comment.