Skip to content

Build application

Build application #7

Workflow file for this run

name: Build application
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag version'
required: true
workflow_call:
inputs:
tag:
type: string
required: true
permissions:
contents: write
pull-requests: write
env:
TAG_NAME: ${{ inputs.tag || github.event.inputs.tag }}
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- name: Detect version
run: echo "New versions is $TAG_NAME"
- name: Checkout the code
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
extensions: curl, mbstring, zip, pcntl, pdo, pdo_sqlite, iconv, json, dom, curl, libxml, fileinfo, tokenizer, xml
ini-values: error_reporting=E_ALL
coverage: xdebug
- name: Install the dependencies
run: composer install --prefer-dist --no-progress --no-interaction --no-suggest
- name: Run tests
run: composer test
- name: Create the PHAR file
run: php ./notifications app:build notifications --build-version=$TAG_NAME --ansi
- name: Show version
run: php builds/notifications --version
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: notifications
path: builds/notifications
retention-days: 1
pull_request:
runs-on: ubuntu-latest
needs: build
name: Create a Pull Request
steps:
- name: Checkout the code
uses: actions/checkout@v4
- name: Make a title
id: title
run: |
echo "title=🏗️ Build the application version ${TAG_NAME}" >> "$GITHUB_OUTPUT"
- name: Show title
run: echo ${{ steps.title.outputs.title }}
- name: Remove old file
run: rm -f builds/notifications
- uses: actions/download-artifact@v4
with:
name: notifications
path: builds
- name: Create a Pull Request
uses: peter-evans/create-pull-request@v7
with:
branch: build/app
branch-suffix: random
delete-branch: true
add-paths: ./builds/notifications
title: ${{ steps.title.outputs.title }}
commit-message: ${{ steps.title.outputs.title }}
body: Application compiled successfully
labels: build