Skip to content

Commit

Permalink
Merge pull request #76 from jolicode/ga
Browse files Browse the repository at this point in the history
GitHub Action: Add support for creating release with GA + upload PHAR into it
  • Loading branch information
lyrixx committed May 30, 2022
2 parents 1341440 + 4a138d2 commit ab79a6e
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 69 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/ci.yml

This file was deleted.

101 changes: 101 additions & 0 deletions .github/workflows/cicd.yml
@@ -0,0 +1,101 @@
name: CI/CD

'on':
push:
branches:
- master
tags:
- v*.*.*
pull_request: null

jobs:
ci:
name: Run the test suite
runs-on: ubuntu-latest
strategy:
matrix:
php-versions:
- '7.4'
- '8.0'

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@2.13.0
with:
php-version: '${{ matrix.php-versions }}'

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run tests
run: composer test

phar:
name: Create a PHAR
runs-on: ubuntu-latest
strategy:
matrix:
php-versions:
- '7.4'
- '8.0'

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@2.13.0
with:
php-version: '${{ matrix.php-versions }}'

- name: Install dependencies (lib)
run: composer install --prefer-dist --no-progress --no-dev --optimize-autoloader --classmap-authoritative

- name: Install dependencies (PHAR builder)
run: composer install --prefer-dist --no-progress --optimize-autoloader --classmap-authoritative
working-directory: tools/phar

- name: Compile PHAR
run: vendor/bin/box compile
working-directory: tools/phar

- name: Ensure PHAR is OK
run: build/jolitypo.phar fr_FR README.md
working-directory: tools/phar

- name: Rename PHAR
run: mv jolitypo.phar jolitypo-${{ matrix.php-versions }}.phar
working-directory: tools/phar/build/

- name: Upload PHAR
uses: actions/upload-artifact@v2
with:
name: 'jolitypo-${{ matrix.php-versions }}'
path: tools/phar/build/jolitypo-${{ matrix.php-versions }}.phar
if-no-files-found: error

release:
if: '${{ startsWith(github.ref, ''refs/tags/v'') }}'
name: Create a release
runs-on: ubuntu-latest
needs:
- ci
- phar

steps:
- name: Download PHAR
uses: actions/download-artifact@v3

- name: Move all PHAR is the current directory
# see https://github.com/actions/download-artifact#download-all-artifacts
run: mv jolitypo*/* .

- name: Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
files: jolitypo-*.phar
37 changes: 0 additions & 37 deletions .github/workflows/phar.yml

This file was deleted.

6 changes: 5 additions & 1 deletion CHANGELOG.md
@@ -1,9 +1,13 @@
CHANGELOG
=========

### 1.3.0 (not released yet) ###
### 1.4.0 (not released yet) ###

### 1.3.0 (2022-05-30) ###

* Add PHAR generation to use the library in CLI context
* Automatically generate a GitHub release when a new tag is pushed
* Automatically add PHAR to GitHub release
* Drop support for PHP < 7.4

### 1.2.0 (2021-08-30) ###
Expand Down

0 comments on commit ab79a6e

Please sign in to comment.