Skip to content

Commit

Permalink
Merge pull request #2 from mtalaeii/main
Browse files Browse the repository at this point in the history
Automate Phar auto-release and Dependabot
  • Loading branch information
Piagrammist authored Jan 14, 2025
2 parents 57f88e9 + 3c1210e commit 2efa6f3
Show file tree
Hide file tree
Showing 3 changed files with 100 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "composer"
directory: "/"
schedule:
interval: "daily"
87 changes: 87 additions & 0 deletions .github/workflows/phar.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
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

jobs:
generate-phar:
name: Generate PHAR and Upload Artifact
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3 # Ensure that the repository is properly checked out

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

- name: Configure PHP for PHAR
run: |
echo "phar.readonly=0" | sudo tee -a /etc/php/8.3/cli/conf.d/99-disable-phar.ini
- name: Verify PHP Configuration
run: php -i | grep "phar.readonly"

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

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

- name: List Files for Debugging
run: ls -l

- name: Rename PHAR File
run: mv scripts/easy-ini.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: Checkout Code Again
uses: actions/checkout@v3 # Make sure it's checked out again in the release job

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

- name: Debug Inputs
run: |
echo "Version: ${{ github.event.inputs.version }}"
echo "Tag: ${{ github.event.inputs.tag }}"
echo "Description: ${{ github.event.inputs.description }}"
- name: Create Release
id: create_release
run: |
VERSION=${{ github.event.inputs.version }}
echo "Creating release for version: $VERSION"
gh release create "$VERSION" easy-ini-${{ github.event.inputs.version }}.phar --title "Release $VERSION" --notes "${{ github.event.inputs.description || 'No description provided.' }}"
env:
GITHUB_TOKEN: ${{ secrets.TOKEN }}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,6 @@ EasyIni\Logger::setLevel(Monolog\Level::Debug);
- [x] Add Linux support.
- [x] Add Logging.
- [x] Expand project into files and release PHAR.
- [ ] Add dependabot for dependency update checks.
- [ ] Automate PHAR release using CD.
- [x] Add dependabot for dependency update checks.
- [x] Automate PHAR release using CD.
- [ ] Add `error_reporting` entry to `ErrorHandlingProcessor`.

0 comments on commit 2efa6f3

Please sign in to comment.