Skip to content

Changed regular version's ZIP file name to be suffixed with '-default… #12

Changed regular version's ZIP file name to be suffixed with '-default…

Changed regular version's ZIP file name to be suffixed with '-default… #12

name: Run tests, dependency audit, CS fixer & deploy
on: [push]
jobs:
check:
name: Audit & code style checks
runs-on: ubuntu-20.04
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.3
- name: Install dependencies
run: composer install
- name: Audit
run: composer audit
- name: Code Style
run: |
curl -L https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v3.57.2/php-cs-fixer.phar -o php-cs-fixer
chmod a+x php-cs-fixer
./php-cs-fixer fix --config=.php-cs-fixer.dist.php --cache-file=.php-cs.cache --diff --dry-run --verbose
build-zip-default:
name: Build the ZIP
needs: [check]
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/') # only tags
steps:
- name: Get tag name
id: set-tag
run: echo "TAG_NAME=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
- name: Check out repository code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Build ZIP
run: ./release/build_release_package.sh
env:
TAG_NAME: ${{ steps.set-tag.outputs.TAG_NAME }}
- name: Rename ZIP file
run: mv ./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}.zip ./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}-default.zip
- name: Store to cache
uses: actions/cache@v4
with:
path: ./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}-default.zip
key: ${{ steps.set-tag.outputs.TAG_NAME }}-${{ github.sha }}-default
build-zip-guzzle-7-4:
name: Build the ZIP with Guzzle 7.4 pinned
needs: [check]
runs-on: ubuntu-20.04
if: startsWith(github.ref, 'refs/tags/') # only tags
steps:
- name: Get tag name
id: set-tag
run: echo "TAG_NAME=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
- name: Check out repository code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
- name: Require Guzzle ~7.4.5
run: composer require "guzzlehttp/guzzle:~7.4.5"
- name: Build ZIP
run: ./release/build_release_package.sh
env:
TAG_NAME: ${{ steps.set-tag.outputs.TAG_NAME }}
- name: Rename ZIP file
run: mv ./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}.zip ./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}-guzzle-7.4.zip
- name: Store to cache
uses: actions/cache@v4
with:
path: ./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}-guzzle-7.4.zip
key: ${{ steps.set-tag.outputs.TAG_NAME }}-${{ github.sha }}-guzzle-7.4
release:
name: Create GitHub release & attach ZIP files
needs: [build-zip-default, build-zip-guzzle-7-4]
if: startsWith(github.ref, 'refs/tags/') # only tags
runs-on: ubuntu-20.04
steps:
- name: Get tag name
id: set-tag
run: echo "TAG_NAME=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
- name: Load from cache (regular ZIP)
uses: actions/cache@v4
with:
path: ./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}-default.zip
key: ${{ steps.set-tag.outputs.TAG_NAME }}-${{ github.sha }}-default
- name: Load from cache (Guzzle 7.4 ZIP)
uses: actions/cache@v4
with:
path: ./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}-guzzle-7.4.zip
key: ${{ steps.set-tag.outputs.TAG_NAME }}-${{ github.sha }}-guzzle-7.4
- name: Release & upload
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.set-tag.outputs.TAG_NAME }}
name: Shopgate Ship from Store for Shopware 5 ${{ steps.set-tag.outputs.TAG_NAME }}
draft: true
prerelease: true
fail_on_unmatched_files: true
files: |
./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}-default.zip
./release/shopgate-shopware5-sfs-${{ steps.set-tag.outputs.TAG_NAME }}-guzzle-7.4.zip
notify-release-success:
name: Notify developers of new release
needs: [release]
runs-on: ubuntu-20.04
if: |
success() &&
startsWith(github.ref, 'refs/tags/')
steps:
- name: Get tag name
id: set-tag
run: echo "TAG_NAME=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
- name: Notify on Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_MERCHANT_UNIT }}
SLACK_USERNAME: 'GitHub Actions'
SLACK_ICON_EMOJI: ':octocat:'
SLACK_TITLE: New release for ${{ github.repository }}
SLACK_MESSAGE: Released version ${{ steps.set-tag.outputs.TAG_NAME }} of ${{ github.repository }}
notify-release-fail:
name: Notify developers of failed release
needs: [release]
runs-on: ubuntu-20.04
if: |
failure() &&
startsWith(github.ref, 'refs/tags/')
steps:
- name: Get tag name
id: set-tag
run: echo "TAG_NAME=${GITHUB_REF:10}" >> $GITHUB_OUTPUT
- name: Notify on Slack
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_MERCHANT_UNIT }}
SLACK_USERNAME: 'GitHub Actions'
SLACK_ICON_EMOJI: ':octocat:'
SLACK_COLOR: '#A30200'
SLACK_TITLE: Release failed for ${{ github.repository }}
SLACK_MESSAGE: Release failed for version ${{ steps.set-tag.outputs.TAG_NAME }} of ${{ github.repository }}