Files
FOSSBilling/.github/workflows/preview.yml
T
dependabot[bot] 8d6bc16476 Bump actions/checkout from 3 to 4 (#1580)
Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-09-05 11:26:28 +02:00

107 lines
3.1 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.0"]
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@v3
with:
node-version: "18"
- name: Check PHP Version
run: php -v
- name: Clone and update the locale submodule.
run: git submodule update --init --remote --recursive
working-directory: ./src/locale
- name: Remove unneeded files from the locale folder
run: |
find -name '*.po' -delete
rm -rf .github
rm -f crowdin.yml messages.pot .git
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: 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'