Skip to content

Commit

Permalink
add automatic tags for all shopware releases
Browse files Browse the repository at this point in the history
  • Loading branch information
shyim committed Jan 24, 2024
1 parent 6e59f8a commit b97ae20
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Update Tags
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
jobs:
update:
name: Update Tags
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Create missing tags
run: bash update.sh
- name: Push tags
run: |
git push --tags
18 changes: 18 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

tags=$(curl -s --fail https://api.github.com/repos/shopware/core/tags)

for tag in $(echo "${tags}" | jq -r '.[].name'); do
# check for the existence of tag in git
if ! git rev-parse "${tag}" >/dev/null 2>&1; then
# update .packages.shopware/core to $tag
echo "Updating shopware/core to ${tag}"
jq --arg tag "${tag}" '.require."shopware/core" = $tag' composer.json > composer.json.tmp
mv composer.json.tmp composer.json
git add composer.json
git commit -m "Update shopware/core to ${tag}"
git tag -m "Release: ${tag}" "${tag}"
git reset --hard origin/trunk
echo "Created tag ${tag}"
fi
done

0 comments on commit b97ae20

Please sign in to comment.