Craft 4 Revisions #37
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Release PHAR | |
| on: | |
| push: | |
| tags: | |
| - '[0-9]*.[0-9]*.[0-9]*' | |
| release: | |
| types: [created] | |
| pull_request: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.3' | |
| ini-values: phar.readonly=0 | |
| - name: Get version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Install dependencies | |
| run: composer install --no-dev --prefer-dist --no-progress --optimize-autoloader | |
| - name: Build PHAR | |
| run: php -d phar.readonly=0 bin/build-phar.php agent-craft.phar | |
| - name: Upload PHAR as artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: agent-craft | |
| path: agent-craft.phar | |
| - name: Upload PHAR to release | |
| if: github.event_name == 'release' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: agent-craft.phar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Upload PHAR to tag release | |
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: agent-craft.phar | |
| tag_name: ${{ steps.version.outputs.version }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |