From 1dffed1606e207f20857779f2a2b43bb6ea45e89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Mon, 30 May 2022 16:17:06 +0200 Subject: [PATCH 1/2] GitHub Action: Add support for creating release with GA + upload PHAR into it Also * Use only one workflow, much easier to manager * Format YAML files * Build PHAR for all commits * Use artifact for all commits * fixed #65 --- .github/workflows/ci.yml | 31 ------------ .github/workflows/cicd.yml | 101 +++++++++++++++++++++++++++++++++++++ .github/workflows/phar.yml | 37 -------------- 3 files changed, 101 insertions(+), 68 deletions(-) delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/cicd.yml delete mode 100644 .github/workflows/phar.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 52aeb07..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Run tests - -on: - push: - branches: [ master ] - pull_request: - -jobs: - build: - - 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 diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml new file mode 100644 index 0000000..184b97d --- /dev/null +++ b/.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 diff --git a/.github/workflows/phar.yml b/.github/workflows/phar.yml deleted file mode 100644 index c2e55c1..0000000 --- a/.github/workflows/phar.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Compile PHAR - -on: - push: - branches: [ master ] - pull_request: - -jobs: - build: - - 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 From 4a138d24f2945ab55a5d2c4587115a5c0d114087 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Mon, 30 May 2022 16:33:51 +0200 Subject: [PATCH 2/2] Add a note in CHANGELOG and prepare v1.3.0 release --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b84cd91..9f9705f 100644 --- a/CHANGELOG.md +++ b/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) ###