Skip to content

Commit

Permalink
Bump VERSION in certificate update PR (#57)
Browse files Browse the repository at this point in the history
  • Loading branch information
ericmj committed Apr 28, 2023
1 parent f107901 commit 9a7f4bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
19 changes: 16 additions & 3 deletions .github/workflows/outdated.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,29 @@
#!/bin/bash

git config user.name "GitHub Actions"
git config user.email "actions@users.noreply.github.com"
function bump_version {
awk -F. '{printf("%d.%d.%d\n", $1, $2, $3+1) >"VERSION"}' VERSION
}

function check_pr {
gh pr list --state open --label "outdated check"
}

git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git checkout outdated || git checkout -b outdated

if ! mix certdata --check-outdated; then
mix certdata

if [[ $(check_pr) == "" ]]; then
bump_version
fi

git add .
git commit -m "Update certificates"
git push --set-upstream origin outdated

if [[ $(gh pr list --state open --label "outdated check") == "" ]]; then
if [[ $(check_pr) == "" ]]; then
gh pr create --fill --label "outdated check"
fi
fi
4 changes: 2 additions & 2 deletions .github/workflows/publish.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
changed_version="$(git diff --name-only HEAD~1 HEAD -- VERSION)"

if [[ "${changed_version}" ]]; then
echo "Publishing because the version changed since the last commit"

git config user.name "${GITHUB_ACTOR}"
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag "v$(cat VERSION)"
git push --tags

Expand Down

0 comments on commit 9a7f4bc

Please sign in to comment.