Files
FOSSBilling/.github/workflows/release-build.yml
T

94 lines
2.9 KiB
YAML

name: 'Build and Prepare Release Archive'
on:
workflow_call:
inputs:
artifact-name:
description: 'The artifact name to use when uploading the preview archive.'
default: 'preview-build'
required: false
type: string
preview:
description: 'Whether the release is a preview release or not.'
default: true
required: false
type: boolean
jobs:
release-build:
name: 'Build and Prepare Release'
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'PHP Build'
uses: FOSSBilling/.workflows/.github/actions/php-build@605d1f1e293f72a5809b6eebcc6c4fb510055c91
with:
cache-deps: 'false'
composer-args: '--prefer-dist --no-dev --optimize-autoloader'
php-version: 8.2
- name: 'Install Node.js and Enable Caching'
uses: actions/setup-node@v4
with:
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
node-version: 20
- name: 'Install Node.js Dependencies'
run: npm ci
- name: 'Build Frontend Assets'
run: npm run build
- name: 'Download Latest Translations'
run: |
wget https://github.com/FOSSBilling/locale/releases/download/latest/translations.zip -O translations.zip
mkdir -p ./src/locale
unzip -o translations.zip -d ./src/locale
- name: 'Copy Required Files and Clean-up'
run: |
cp README.md ./src/
cp LICENSE ./src/
rm translations.zip
rm -r ./src/themes/admin_default/node_modules/
- name: 'Add Short Commit Hash as the Release Vesion'
if: ${{ inputs.preview }}
run: sed -i s/0.0.1/${GITHUB_SHA::7}/ Version.php
working-directory: ./src/library/FOSSBilling
- name: 'Add the Branch/Tag Name as the Release Version'
if: ${{ inputs.preview == false }}
run: sed -i s/0.0.1/${{ github.ref_name }}/ Version.php
working-directory: ./src/library/FOSSBilling
- name: 'Add 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: ./src/library/FOSSBilling
env:
SENTRY_DSN: ${{ vars.SENTRY_DSN }}
- name: 'Correct the file & folder permissions'
run: |
cd ./src/
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
- name: 'Create Release Build Archive'
run: tar -cvf /tmp/build.tar -C ./src/ ./
- name: 'Upload Release Build Archive'
uses: actions/upload-artifact@v4
with:
if-no-files-found: 'error'
name: ${{ inputs.artifact-name }}
path: /tmp/build.tar
retention-days: 1