mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-01 21:02:54 +09:00
* Bump minimum PHP version to 8.1 * Missed these too * Shit's broke and stupid as fuck * Update SentryHelper.php * Update package-lock.json * I did the fixing --------- Co-authored-by: Belle Aerni <belleaerni@gmail.com>
123 lines
3.6 KiB
YAML
123 lines
3.6 KiB
YAML
name: Create 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.1"]
|
|
|
|
|
|
name: Create a downloadable preview build
|
|
steps:
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: ${{ matrix.php-versions }}
|
|
|
|
- name: Install Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "18"
|
|
|
|
- name: Check PHP Version
|
|
run: php -v
|
|
|
|
- name: Remove placeholder locale files
|
|
run: rm -rf *
|
|
working-directory: ./src/locale
|
|
|
|
- name: Download the latest translations
|
|
uses: robinraju/release-downloader@v1.8
|
|
with:
|
|
repository: "FOSSBilling/locale"
|
|
fileName: "translations.zip"
|
|
out-file-path: "./src/locale"
|
|
latest: true
|
|
|
|
- name: Extract the translations
|
|
run: |
|
|
unzip translations.zip
|
|
rm -f translations.zip
|
|
working-directory: ./src/locale
|
|
|
|
- name: Validate composer.json and composer.lock
|
|
run: composer validate
|
|
|
|
- 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: npm run build
|
|
|
|
- name: Installing Composer dependencies
|
|
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader
|
|
|
|
- name: Copy mandatory files to the temporary build folder
|
|
run: |
|
|
cp -r ./src/. ./build/source/
|
|
cp -r ./src/vendor/. ./build/source/vendor/
|
|
cp README.md ./build/source/
|
|
cp LICENSE ./build/source/
|
|
cp CHANGELOG.md ./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/FOSSBilling
|
|
|
|
- name: Add in the Sentry DSN
|
|
if: ${{ vars.SENTRY_DSN }}
|
|
run: |
|
|
d=$'\03'
|
|
sed -i "s${d}--replace--this--during--release--process--${d}$SENTRY_DSN$d" SentryHelper.php
|
|
working-directory: ./build/source/library/FOSSBilling
|
|
env:
|
|
SENTRY_DSN: ${{ vars.SENTRY_DSN }}
|
|
|
|
- name: Upload the Final Artifact to GitHub
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: FOSSBilling Preview
|
|
path: ./build/source/*
|
|
if-no-files-found: error
|
|
|
|
- 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 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'
|