Merge pull request #191 from akunzai/dependabot/composer/guzzlehttp/p… #47
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: Release | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["[0-9]+.*"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| draft-release: | |
| name: Update Release Draft | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Delete existing draft releases | |
| run: | | |
| gh release list --json tagName,isDraft \ | |
| --jq '.[] | select(.isDraft) | .tagName' | \ | |
| xargs -r -I{} gh release delete {} -y | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_REPO: ${{ github.repository }} | |
| - uses: release-drafter/release-drafter@v7 | |
| with: | |
| publish: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish-release: | |
| name: Publish GitHub Release | |
| if: github.ref_type == 'tag' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check pre-release | |
| id: check | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| if echo "$TAG" | grep -qE '(alpha|beta|dev|preview|rc)'; then | |
| echo "prerelease=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "prerelease=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - id: release-drafter | |
| uses: release-drafter/release-drafter@v7 | |
| with: | |
| publish: true | |
| prerelease: ${{ steps.check.outputs.prerelease == 'true' }} | |
| tag: ${{ github.ref_name }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| upload-assets: | |
| name: Upload Release Assets | |
| needs: publish-release | |
| if: github.ref_type == 'tag' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up PHP | |
| uses: shivammathur/setup-php@v2 | |
| with: | |
| php-version: '8.4' | |
| extensions: ctype, curl, dom, gd, hash, iconv, intl, json, libxml, mbstring, pdo, simplexml, soap, zip | |
| coverage: none | |
| - name: Validate composer.json and composer.lock | |
| run: composer validate --strict | |
| - name: Set up Composer | |
| run: composer config -g repositories.firegento composer https://packages.firegento.com | |
| - name: Cache Composer packages | |
| id: composer-cache | |
| uses: actions/cache@v5 | |
| with: | |
| path: vendor | |
| key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-php- | |
| - name: Install dependencies | |
| run: composer install --prefer-dist --no-progress | |
| - name: Bundle extensions | |
| run: ./bundle.sh | |
| - name: Upload release assets | |
| run: gh release upload "${{ github.ref_name }}" dist/pkg_magebridge.zip --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |