Skip to content

LAN-164 - Add automated releases #1

LAN-164 - Add automated releases

LAN-164 - Add automated releases #1

Workflow file for this run

name: Prepare Release
on:
workflow_dispatch:
# TODO: Remove when PR ready
pull_request:
jobs:
prepare_release:
runs-on: ubuntu-latest
steps:
# Disabled for testing purposes
#- uses: octo-sts/action@main
# id: octo-sts
# with:
# scope: shopware/SwagLanguagePack
# identity: release
- uses: actions/checkout@v4
with:
# token: ${{ steps.octo-sts.outputs.token }}
fetch-tags: true
- name: Check for changes
shell: bash
id: check-changes
run: |
if [[ -z $(git diff HEAD $(git describe --tags $(git rev-list --tags --max-count=1)) src/) ]]; then
echo "No changes detected"
echo "no_changes=1" >> "$GITHUB_OUTPUT"
fi
- name: Increase version
shell: bash
if: ${{ ! steps.check-changes.outputs.no_changes }}
run: |
version=$(jq -r '.version' composer.json)
regex="([0-9]+).([0-9]+).([0-9]+)"
if [[ $version =~ $regex ]]; then
major="${BASH_REMATCH[1]}"
minor="${BASH_REMATCH[2]}"
fi
new_version="${major}.$((minor+1)).0"
jq --arg version "$new_version" '.version = $version' composer.json > composer.json.tmp
mv composer.json.tmp composer.json
composer validate
- name: Push new version
if: ${{ ! steps.check-changes.outputs.no_changes }}
shell: bash
run: |
git config user.name shopwareBot
git config user.email development@shopware.com
git add .
git commit -m "Prepare release $(jq -r '.version' composer.json)"
git diff HEAD $(git describe --tags $(git rev-list --tags --max-count=1)) src/
# git push
# Disabled for testing purposes
# release:
# needs: prepare_release
# uses: shopware/SwagLanguagePack/.github/workflows/store-release.yml@master