Nightly Build #273
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
# This workflow aim to create nightly builds on active branches | |
name: Nightly Build | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
permissions: | |
contents: read | |
jobs: | |
nightly-build: | |
name: Nightly Build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
BRANCH: | |
- develop | |
- 9.0.x | |
- 8.2.x | |
- 8.1.x | |
- 8.0.x | |
- 1.7.8.x | |
include: | |
- BRANCH: develop | |
node: 20 | |
- BRANCH: 9.0.x | |
node: 20 | |
- BRANCH: 8.2.x | |
node: 16 | |
- BRANCH: 8.1.x | |
node: 16 | |
- BRANCH: 8.0.x | |
node: 14 | |
- BRANCH: 1.7.8.x | |
node: 14 | |
env: | |
PHP_VERSION: '7.4' | |
NODE_VERSION: ${{ matrix.node }} | |
RELEASE_DIR: '/tmp/ps-release' | |
GH_BRANCH: ${{ matrix.BRANCH }} | |
GC_PROJECT_ID: ${{ secrets.GC_PROJECT_ID }} | |
GC_SERVICE_KEY: ${{ secrets.GC_SERVICE_KEY }} | |
XML_FILE: ${{ matrix.BRANCH == 'develop' && 'nightly.xml' || format('nightly_{0}.xml', matrix.BRANCH)}} | |
ZIP_FILE: ${{ matrix.BRANCH == 'develop' && 'nightly.zip' || format('nightly_{0}.zip', matrix.BRANCH)}} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
ref: ${{ env.GH_BRANCH }} | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: ${{ env.PHP_VERSION }} | |
extensions: mbstring, intl, gd, xml, dom, json, fileinfo, curl, zip, iconv | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
- name: Create Release directory | |
run: mkdir -p ${{ env.RELEASE_DIR }} | |
- name: Create build | |
run: php tools/build/CreateRelease.php --destination-dir=${{ env.RELEASE_DIR }} | |
- name: Rename build | |
run: today=`date +%Y-%m-%d`; for i in *; do mv $i $today-$GH_BRANCH-$i; done | |
working-directory: ${{ env.RELEASE_DIR }} | |
- name: Create nightly.(zip & xml) for each branch | |
run: | | |
today=`date +%Y-%m-%d` | |
cp $today-$GH_BRANCH*.zip ${{ env.ZIP_FILE }} | |
cp $today-$GH_BRANCH*.xml ${{ env.XML_FILE }} | |
working-directory: ${{ env.RELEASE_DIR }} | |
- name: Auth Cloud Sdk | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: ${{ env.GC_SERVICE_KEY }} | |
project_id: ${{ env.GC_PROJECT_ID }} | |
- name: Setup Cloud Sdk | |
uses: google-github-actions/setup-gcloud@v1 | |
- name: Delete last Nightly zip for each branch | |
run: gsutil rm -rf gs://prestashop-core-nightly/${{ env.ZIP_FILE }} | |
- name: Delete last Nightly xml for each branch | |
run: gsutil rm -rf gs://prestashop-core-nightly/${{ env.XML_FILE }} | |
- name: Upload to Google Cloud Storage (GCS) | |
if: always() | |
run: gsutil cp -r "${{ env.RELEASE_DIR }}/**" gs://prestashop-core-nightly |