From bd80a9d4bb18faac6236605c82ae050eb97e7b45 Mon Sep 17 00:00:00 2001 From: Peter Siegmund Date: Mon, 16 Sep 2024 21:59:51 +0200 Subject: [PATCH] setup github actions Signed-off-by: Peter Siegmund --- .github/dependabot.yml | 11 ++++++++ .github/workflows/deploy-hetzner.yaml | 40 +++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/deploy-hetzner.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..cbc0c13 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + + - package-ecosystem: "maven" + directory: "/" + schedule: + interval: "weekly" diff --git a/.github/workflows/deploy-hetzner.yaml b/.github/workflows/deploy-hetzner.yaml new file mode 100644 index 0000000..710bd1a --- /dev/null +++ b/.github/workflows/deploy-hetzner.yaml @@ -0,0 +1,40 @@ +--- +name: 'deploy to hetzner' + +on: + push: + branches: + - main + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Cancel Previous Runs + uses: styfle/cancel-workflow-action@0.12.1 + with: + access_token: ${{ github.token }} + + - name: Cloning repo + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + + - name: Build and test with Maven + run: mvn --batch-mode --update-snapshots verify + + - name: Push to dokku + timeout-minutes: 15 + uses: dokku/github-action@master + with: + branch: main + git_remote_url: ${{ secrets.HETZNER_GIT_URI }} + ssh_private_key: ${{ secrets.SSH_PRIVATE_KEY }} + git_push_flags: --force