Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up and maintenance #17

Merged
merged 5 commits into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/auto-merge-dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Auto-merge Dependabot
on:
pull_request:
types:
- opened
branches:
- 'main'

permissions:
pull-requests: write
contents: write

jobs:
auto-merge:
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
steps:
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: peter-evans/enable-pull-request-automerge@v3
with:
token: ${{ steps.generate-token.outputs.token }}
pull-request-number: ${{ github.event.pull_request.number }}
merge-method: squash
27 changes: 27 additions & 0 deletions .github/workflows/auto-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: "Auto Release"
on:
pull_request:
types:
- closed

jobs:
auto-release:
if: github.event.pull_request.merged == true && github.event.pull_request.user.login == 'dependabot[bot]'
name: "Auto Release"
runs-on: "ubuntu-latest"
steps:
- id: get-version
run: |
LATEST_TAG=$(curl -s "https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest" | jq -r '.name')
URL='https://gist.githubusercontent.com/mietzen/cd33efb65f91619201a45ac50dcfc29e/raw/bump-version'
echo "version=v$(wget -qO - ${URL} | bash -s ${LATEST_TAG} minor)" >> $GITHUB_OUTPUT
- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: "softprops/action-gh-release@v1"
with:
token: ${{ steps.generate-token.outputs.token }}
tag_name: ${{ steps.get-version.outputs.version }}
generate_release_notes: true
17 changes: 1 addition & 16 deletions Docker/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
import logging
from time import sleep
from porkbun_ddns import PorkbunDDNS, cli
from porkbun_ddns import PorkbunDDNS

logger = logging.getLogger('porkbun_ddns')
logger.setLevel(logging.INFO)
Expand Down Expand Up @@ -32,21 +32,6 @@
for handler in logger.handlers:
handler.setLevel(logging.DEBUG)

if os.getenv('INTEGRATION_TEST'):
logger.info('\n------------------------------------')
logger.info('INTEGRATION TEST! logger.infoing help menu')
logger.info('------------------------------------\n')
while True:
try:
cli.main(argv=['-h'])
except SystemExit:
pass
finally:
logger.info('\n------------------------------------')
logger.info('Sleeping... {}s'.format(sleep_time))
logger.info('------------------------------------\n')
sleep(sleep_time)

if not all([os.getenv('DOMAIN'), os.getenv('SECRETAPIKEY'), os.getenv('APIKEY')]):
logger.info('Please set DOMAIN, SECRETAPIKEY and APIKEY')
sys.exit(1)
Expand Down
24 changes: 24 additions & 0 deletions Docker/test/integration/assets/entrypoint.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import os
import logging
from time import sleep
from porkbun_ddns import cli

logger = logging.getLogger('porkbun_ddns')
logger.setLevel(logging.INFO)
logger.propagate = False

sleep_time = int(os.getenv('SLEEP', 300))

logger.info('\n------------------------------------')
logger.info('INTEGRATION TEST!')
logger.info('------------------------------------\n')
while True:
try:
cli.main(argv=['-h'])
except SystemExit:
pass
finally:
logger.info('\n------------------------------------')
logger.info('Sleeping... {}s'.format(sleep_time))
logger.info('------------------------------------\n')
sleep(sleep_time)
4 changes: 3 additions & 1 deletion Docker/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

set -xe

SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )

echo "Setup"
docker run -d --rm \
--name porkbun-ddns \
--platform ${PLATFORM} \
--env "INTEGRATION_TEST=1" \
--env "SLEEP=301" \
--volume ${SCRIPT_DIR}/integration/assets/entrypoint.py:/entrypoint.py \
"${DOCKER_USER}/porkbun-ddns:${VERSION}-${ARCH}-${BUILD_NR}"

# Install tools needed for inspect
Expand Down