Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Release
on:
release:
types: [ created ]

permissions: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
PHP_VERSION: '8.5'

jobs:
build-phar:
runs-on: ubuntu-latest
name: Build PHAR
permissions:
contents: read
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ env.PHP_VERSION }}
ini-values: phar.readonly=0
coverage: none
tools: box

- name: Install dependencies
uses: ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda # 4.0.0
with:
ignore-cache: true

- name: Create PHAR
run: |
box compile

- name: Validate PHAR
run: |
php -r "require 'phar://pdfparser.phar/vendor/autoload.php'; exit(class_exists('\PrinsFrank\PdfParser\PdfParser') === true ? 0 : 1);"

- name: Upload PHAR
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: phar
if-no-files-found: 'error'
path: |
pdfparser.phar

publish-phar:
runs-on: ubuntu-latest
name: Publish PHAR
needs:
- build-phar
if: github.event_name == 'release'
permissions:
contents: write # To be able to update release
steps:
- name: Download PHAR
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: phar
path: .

- name: Upload PHAR to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAG_NAME: ${{ github.event.release.tag_name }}
REPO: ${{ github.repository }}
run: |
gh release upload "$TAG_NAME" pdfparser.phar --repo "$REPO"
4 changes: 4 additions & 0 deletions box.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"main": false,
"output": "pdfparser.phar"
}
Loading