Skip to content

Commit

Permalink
Add support for automatic phar release
Browse files Browse the repository at this point in the history
  • Loading branch information
mtalaeii committed Jan 14, 2025
1 parent 89d9df7 commit c461947
Showing 1 changed file with 84 additions and 0 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/phar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Create and Release PHAR

on:
workflow_dispatch:
inputs:
version:
description: "Release version (e.g., 1.0.0)"
required: true
tag:
description: "Git tag (e.g., v1.0.0)"
required: true
description:
description: "Release description"
required: false

workflow_run:
workflows: ["CI"] # Name of your CI workflow
types:
- completed

jobs:
check-tests:
name: Verify Test Status
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest

steps:
- name: Tests Passed
run: echo "All tests passed. Proceeding to release generation."

generate-phar:
name: Generate PHAR and Upload Artifact
needs: check-tests
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Set up PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'

- name: Install Dependencies
run: composer install --no-dev

- name: Run makephar.php
run: php scripts/makephar.php
env:
OUTPUT_FILE: artifact.phar

- name: Rename PHAR File
run: mv artifact.phar easy-ini-${{ github.event.inputs.version }}.phar

- name: Upload PHAR Artifact
uses: actions/upload-artifact@v3
with:
name: easy-ini-${{ github.event.inputs.version }}.phar
path: ./easy-ini-${{ github.event.inputs.version }}.phar

create-release:
name: Create GitHub Release
needs: generate-phar
runs-on: ubuntu-latest
permissions:
contents: write

steps:
- name: Download PHAR Artifact
uses: actions/download-artifact@v3
with:
name: easy-ini-${{ github.event.inputs.version }}.phar

- name: Create Release
uses: actions/create-release@v1
with:
tag_name: ${{ github.event.inputs.tag }}
release_name: "Release ${{ github.event.inputs.version }}"
body: ${{ github.event.inputs.description || 'No description provided.' }}
draft: true
prerelease: false
files: easy-ini-${{ github.event.inputs.version }}.phar
token: ${{ secrets.TOKEN }}

0 comments on commit c461947

Please sign in to comment.