mirror of
https://github.com/FOSSBilling/FOSSBilling.git
synced 2026-12-01 21:02:54 +09:00
90 lines
2.7 KiB
YAML
90 lines
2.7 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@8cdd61a976263ca52e1d53580c4d421d5f518369
|
|
with:
|
|
cache-deps: 'false'
|
|
composer-args: '--prefer-dist --no-dev --optimize-autoloader'
|
|
php-version: 8.1
|
|
|
|
- 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'
|
|
uses: robinraju/release-downloader@v1.8
|
|
with:
|
|
repository: 'FOSSBilling/locale'
|
|
latest: true
|
|
fileName: 'translations.zip'
|
|
out-file-path: './src/locale'
|
|
extract: true
|
|
|
|
- name: 'Copy Required Files and Clean-up'
|
|
run: |
|
|
cp README.md ./src/
|
|
cp LICENSE ./src/
|
|
rm ./src/locale/translations.zip
|
|
|
|
- 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: '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
|