Skip to content

Commit

Permalink
ci: auto patch-release every 2 weeks (#318)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdnoC authored and michael-siek committed Feb 7, 2024
1 parent 03ca823 commit d88406d
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/scripts/prerpare_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

# Fail on first error.
set -e

releaseLevel="$1"

oldVersion="$(node -pe 'require("./package.json").version')"
npx standard-version --release-as "$releaseLevel" --skip.commit=true --skip.changelog=true --skip.tag=true

cd selenium
npx standard-version --release-as "$releaseLevel" --skip.commit=true --skip.changelog=true --skip.tag=true
cd ..
newVersion="$(node -pe 'require("./package.json").version')"


# xmlstarlet is used to edit xml files
sudo apt-get install -y xmlstarlet

updateXML() {
xpath="$1"
newValue="$2"
file="$3"

# Update file inplace (--inplace) and preserve formatting (-P)
xmlstarlet edit -P --inplace --update "$xpath" --value "$newValue" "$file"
}

versionXpath=/_:project/_:version
parentVersionXpath=/_:project/_:parent/_:version
# Reads as: Select the "version" node of the "dependency" node that has a "groupId" node which matches "com.deque.html.axe-devtools"
dequeDepVersionXpath='/_:project/_:dependencies/_:dependency[_:groupId="com.deque.html.axe-core"]/_:version'
propertiesVersionXpath=/_:project/_:properties/_:version

updateXML "$versionXpath" "$newVersion" pom.xml

# Update version, the version of parent, and version of any ADT deps in our ADT packages
for package in utilities selenium playwright; do
updateXML "$versionXpath" "$newVersion" "$package"/pom.xml
updateXML "$parentVersionXpath" "$newVersion" "$package"/pom.xml
# If no dep is found no change will be made
updateXML "$dequeDepVersionXpath" "$newVersion" "$package"/pom.xml
done

npx conventional-changelog-cli -p angular -i CHANGELOG.md -s

13 changes: 13 additions & 0 deletions .github/workflows/auto-patch-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Automatically create patch release every 2 weeks
on:
schedule:
# Run every Friday right before midnight
- cron: '59 23 * * 5'
jobs:
create_patch_release:
uses: dequelabs/axe-api-team/.github/workflows/auto-patch-release.yml
secrets: inherit
with:
release-command: bash .github/scripts/prepare_release.sh
release-branch: master
default-branch: develop
27 changes: 27 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d88406d

Please sign in to comment.