Files
FOSSBilling/.github/workflows/preview.yml
T
Adam Daley 778e40f461 Update Github workflows (#1203)
* Update labeler workflow

Update labeler workflow to remove old labels and paths, fix path patterns, and include more labels.

* Update release drafter workflow config

Update the release drafter workflow config to remove autolabeler options as unnecessary and currently broken.

* Update Dependabot workflow config

Update Dependabot workflow config with new Composer manifests location.

* Update spellcheck workflow

Update spellcheck workflow to change filename, also run on push, and to only check changed files.

* Merge PHP build and tests into one PHP CI workflow

* Update CKEditor workflow

Update CKEditor workflow to change file name and to only run on repos owned by the FOSSBilling organisation.

* Fix Preview double zip issue
2023-05-02 05:40:34 +01: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@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: "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'