mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-11-30 12:18:43 +09:00
97 lines
2.8 KiB
YAML
97 lines
2.8 KiB
YAML
name: Create a downloadable preview build
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ${{ matrix.operating-system }}
|
|
|
|
strategy:
|
|
matrix:
|
|
operating-system: [ubuntu-latest]
|
|
|
|
php-versions: ["8.0"]
|
|
|
|
|
|
name: Create a downloadable preview build
|
|
steps:
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Install PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-versions }}
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "16"
|
|
|
|
- name: Check PHP Version
|
|
run: php -v
|
|
|
|
- name: Validate composer.json and composer.lock
|
|
run: composer validate
|
|
working-directory: ./src
|
|
|
|
- name: Installing NPM dependencies
|
|
run: npm install
|
|
|
|
- name: Create temporary directories and files
|
|
run: |
|
|
mkdir -p ./src/data/{cache,log,uploads}
|
|
touch ./src/data/{cache,log,uploads}/index.html
|
|
mkdir -p ./build/{code-browser,code-coverage,logs,pdepend,update,distribution,source}
|
|
|
|
- name: Build assets
|
|
run: gulp build
|
|
|
|
- name: Copy mandatory files to the temporary build folder
|
|
run: |
|
|
cp -r ./src/* ./build/source/
|
|
cp README.md ./build/source/
|
|
cp LICENSE ./build/source/
|
|
cp CHANGELOG.md ./build/source/
|
|
|
|
- name: Installing Composer dependencies
|
|
run: composer install --prefer-dist --no-progress --no-suggest --no-dev --optimize-autoloader
|
|
working-directory: ./build/source
|
|
|
|
- name: Add short commit hash as the release number
|
|
run: |
|
|
sed s/0.0.1/${GITHUB_SHA::7}/ Version.php > Version2.php
|
|
mv Version2.php Version.php
|
|
working-directory: ./build/source/library/Box
|
|
|
|
- name: Create the final archive
|
|
run: zip -r ./FOSSBilling-preview.zip .
|
|
working-directory: ./build/source/
|
|
|
|
- name: Copy the archive to its final location
|
|
run: cp ./build/source/FOSSBilling-preview.zip ./build/distribution
|
|
|
|
- name: Upload the final artifact to GitHub
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: FOSSBilling Preview Archive
|
|
path: ./build/distribution/FOSSBilling-preview.zip
|
|
if-no-files-found: error
|
|
|
|
- name: Upload the final artifact to our S3 bucket
|
|
if: github.ref == 'refs/heads/main'
|
|
uses: jakejarvis/s3-sync-action@master
|
|
with:
|
|
args: --acl public-read --follow-symlinks
|
|
env:
|
|
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
AWS_S3_ENDPOINT: ${{ secrets.AWS_S3_ENDPOINT }}
|
|
SOURCE_DIR: './build/distribution'
|