Skip to content

feat: symfony messenger delays (#613) #234

feat: symfony messenger delays (#613)

feat: symfony messenger delays (#613) #234

Workflow file for this run

name: 'Releasing latest changes'
on:
push:
tags:
- '*'
# Cancel in-progress jobs when a new commit is pushed
concurrency:
group: release-${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
env:
# 1. for Github split
GITHUB_TOKEN: ${{ secrets.ECOTONE_BOT_TOKEN }}
jobs:
prepare-code-for-release:
name: "Auto fix PHP CS and set up required package versions"
runs-on: ubuntu-latest
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
- name: We need to fetch all related branches to perform next action
uses: actions/checkout@v4
with:
fetch-depth: '0'
token: ${{ secrets.ECOTONE_BOT_TOKEN }}
- name: Ensure ECOTONE_ENTERPRISE_PUBLIC_KEY secret exists
run: |
if [ -z "${{ secrets.ECOTONE_ENTERPRISE_PUBLIC_KEY }}" ]; then
echo "ECOTONE_ENTERPRISE_PUBLIC_KEY secret is missing"
exit 1
fi
- name: Setup Git
run: |
git config user.name "Ecotone Framework Bot"
git config user.email "[email protected]"
- name: Checkout branch related to tag
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "checking out branch $branch for tag ${GITHUB_REF#refs/tags/}"
git checkout $branch
- name: Install PHP-CS-Fixer
run: |
composer global require friendsofphp/php-cs-fixer
export PATH="$PATH:$HOME/.composer/vendor/bin"
- name: Run PHP CS Fixer
run: php-cs-fixer fix --config=.php-cs-fixer.dist.php --allow-risky=yes
- name: Run Update Required Packages
run: php bin/update-required-packages.php ${{ github.ref_name }}
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Release ${{ github.ref_name }}
get_packages:
name: Package splitting
needs: prepare-code-for-release
runs-on: ubuntu-latest
steps:
- name: Set Up PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: none
- uses: actions/checkout@v2
- name: Get Packages
id: get_json
run: echo "::set-output name=json::$(bin/get-packages)"
- name: Output Packages
run: echo "${{ steps.get_json.outputs.json }}"
outputs:
matrix: ${{ steps.get_json.outputs.json }}
split_packages:
name: Split Package ${{ matrix.package.name }}
needs: get_packages
runs-on: ubuntu-latest
strategy:
fail-fast: true # Fail the entire workflow if any job fails
matrix:
package: ${{ fromJson(needs.get_packages.outputs.matrix) }}
steps:
# We need to check out what we've committed in prepare-code-for-release
- name: We need to fetch all related branches to perform next action
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Checkout branch related to tag
run: |
raw=$(git branch -r --contains ${{ github.ref }})
branch=${raw##*/}
echo "checking out branch $branch for tag ${GITHUB_REF#refs/tags/}"
git checkout $branch
- name: Replace key.pem with ECOTONE_ENTERPRISE_PUBLIC_KEY
if: ${{ matrix.package.name == 'ecotone' }}
run: |
echo "${{ secrets.ECOTONE_ENTERPRISE_PUBLIC_KEY }}" > ${{ matrix.package.directory }}/src/Messaging/Config/Licence/key.pem
-
uses: "danharrin/[email protected]"
if: "startsWith(github.ref, 'refs/tags/')"
with:
tag: ${GITHUB_REF#refs/tags/}
# ↓ split "packages/easy-coding-standard" directory
package_directory: '${{ matrix.package.directory }}'
# ↓ into https://github.com/symplify/easy-coding-standard repository
repository_organization: '${{ matrix.package.organisation }}'
repository_name: '${{ matrix.package.repository }}'
commit_message: 'Release version ${{ github.ref_name }}'
# ↓ the user signed under the split commit
user_name: "Ecotone FrameworkBot"
user_email: "[email protected]"
tweet:
runs-on: ubuntu-latest
needs: discord-notification
steps:
- uses: Eomm/why-don-t-you-tweet@v1
with:
tweet-message: New Ecotone version was released ${{ github.ref_name }}. Check the changelog on https://github.com/ecotoneframework/ecotone-dev/releases/tag/${{ github.ref_name }}
env:
# Get your tokens from https://developer.twitter.com/apps
TWITTER_CONSUMER_API_KEY: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
TWITTER_CONSUMER_API_SECRET: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
TWITTER_ACCESS_TOKEN: ${{ secrets.TWITTER_ACCESS_TOKEN }}
TWITTER_ACCESS_TOKEN_SECRET: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}
discord-notification:
runs-on: ubuntu-latest
needs: split_packages
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Send Discord Notification
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DISCORD_WEBHOOK_URL: ${{ secrets.ECOTONE_DISCORD_SERVER_URL }}
VERSION: ${{ github.ref_name }}
run: |
# Fetch release notes from GitHub
RELEASE_NOTES=$(gh release view "$VERSION" --repo ecotoneframework/ecotone-dev --json body -q '.body // "No release notes available"')
# Truncate if too long (Discord embed description limit is 4096 chars)
if [ ${#RELEASE_NOTES} -gt 4000 ]; then
RELEASE_NOTES="${RELEASE_NOTES:0:3997}..."
fi
# Get current timestamp
TIMESTAMP=$(date -u +%Y-%m-%dT%H:%M:%S.000Z)
# Create JSON payload using jq to properly escape everything
PAYLOAD=$(jq -n \
--arg title "🚀 New Ecotone Release: $VERSION" \
--arg description "$RELEASE_NOTES" \
--arg url "https://github.com/ecotoneframework/ecotone-dev/releases/tag/$VERSION" \
--arg version "$VERSION" \
--arg timestamp "$TIMESTAMP" \
'{
"embeds": [{
"title": $title,
"description": $description,
"url": $url,
"color": 5814783,
"fields": [
{
"name": "Version",
"value": ("`" + $version + "`"),
"inline": true
},
{
"name": "Source",
"value": "Ecotone Development",
"inline": true
}
],
"footer": {
"text": "Ecotone Framework",
"icon_url": "https://avatars.githubusercontent.com/u/47981056?s=48&v=4"
},
"timestamp": $timestamp
}]
}')
curl -H "Content-Type: application/json" \
-X POST \
-d "$PAYLOAD" \
"$DISCORD_WEBHOOK_URL"