mirror of
https://github.com/pi-hole/PADD.git
synced 2026-04-19 00:04:20 +01:00
Bumps [actions/checkout](https://github.com/actions/checkout) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](8e8c483db8...de0fac2e45)
---
updated-dependencies:
- dependency-name: actions/checkout
dependency-version: 6.0.2
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
56 lines
2.3 KiB
YAML
56 lines
2.3 KiB
YAML
name: Version bump
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
schedule:
|
|
- cron: "0 * * * *"
|
|
|
|
jobs:
|
|
bump:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
REPO: ${{ github.repository }}
|
|
GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
|
steps:
|
|
- name: Get latest release tag # can also be a draft release
|
|
run: |
|
|
LATEST_TAG=$(gh -R $REPO release list -L 1 | awk '{printf $3}')
|
|
echo "Latest version tag for releases in $REPO is $LATEST_TAG"
|
|
echo "latest_tag=$LATEST_TAG" >> $GITHUB_ENV
|
|
# Exit when LATEST_TAG is empty, due to github connection errors
|
|
if [[ -z "${LATEST_TAG}" ]]; then echo "Error: LATEST_TAG is empty, aborting" && exit 1; fi;
|
|
shell: bash
|
|
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd #v6.0.2
|
|
with:
|
|
ref: 'development'
|
|
|
|
- name: Check if branch already exists
|
|
run: |
|
|
LATEST_TAG=${{ env.latest_tag }}
|
|
REMOTE_BRANCH=$(git ls-remote --heads origin "bump_$LATEST_TAG")
|
|
[[ -z "${REMOTE_BRANCH}" ]] && echo "branch_exists=false" >> $GITHUB_ENV || echo "branch_exists=true" >> $GITHUB_ENV
|
|
[[ -z "${REMOTE_BRANCH}" ]] && echo "Remote branch bump_$LATEST_TAG does not exist" || echo "Remote branch bump_$LATEST_TAG already exists"
|
|
shell: bash
|
|
|
|
- name: Get current version
|
|
run: |
|
|
CURRENT_VERSION=$(cat padd.sh | grep '^padd_version=' | cut -d'"' -f 2)
|
|
echo "Current PADD version is $CURRENT_VERSION"
|
|
echo "current_version=$CURRENT_VERSION" >> $GITHUB_ENV
|
|
shell: bash
|
|
|
|
- name: Create PR if versions don't match and branch does not exist
|
|
if: (env.current_version != env.latest_tag) && (env.branch_exists == 'false')
|
|
run: |
|
|
LATEST_TAG=${{ env.latest_tag }}
|
|
git config --global user.email "pralor-bot@users.noreply.github.com"
|
|
git config --global user.name "pralor-bot"
|
|
git checkout -b "bump_$LATEST_TAG" development
|
|
sed -i "s/^padd_version=.*/padd_version=\"$LATEST_TAG\"/" padd.sh
|
|
git commit -a -m "Bump version to $LATEST_TAG"
|
|
git push --set-upstream origin "bump_$LATEST_TAG"
|
|
gh pr create -B development -H "bump_$LATEST_TAG" --title "Bump version to ${LATEST_TAG}" --body 'Created by Github action' --label 'Internal'
|
|
shell: bash
|