better detection when no one is at home #114
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish backend to DockerHub | |
on: | |
push: | |
branches: [ feature/* ] | |
paths: | |
- 'backend/src/**' | |
- 'backend/build.gradle' | |
- '.github/workflows/publish-backend-feature.yml' | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
environment: Publish | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: adopt | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v2 | |
- name: Java build | |
working-directory: ./backend | |
run: ./gradlew build --no-daemon | |
env: | |
REPO_USERNAME: '${{ secrets.REPO_GITHUB_NAME }}' | |
REPO_TOKEN: '${{ secrets.REPO_GITHUB_TOKEN }}' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USER }} | |
password: ${{ secrets.DOCKER_PASS }} | |
- name: Build and push | |
uses: docker/build-push-action@v4 | |
with: | |
context: backend/ | |
file: backend/src/main/docker/Dockerfile.jvm | |
platforms: linux/amd64,linux/arm/v7,linux/arm64/v8 | |
push: true | |
pull: true | |
tags: akop/home-system:unstable | |
deploy: | |
runs-on: ubuntu-latest | |
needs: publish | |
steps: | |
- run: sudo apt install wireguard | |
- run: echo "${{ secrets.WIREGUARD_CLIENT_PRIVATE_KEY }}" > privatekey | |
- run: sudo ip link add dev wg0 type wireguard | |
- run: sudo ip address add dev wg0 ${{ secrets.WIREGUARD_CLIENT_IP }} peer ${{ secrets.WIREGUARD_ALLOWED_IPS }} | |
- run: sudo wg set wg0 private-key privatekey peer ${{ secrets.WIREGUARD_SERVER_PUBLIC_KEY }} allowed-ips ${{ secrets.WIREGUARD_ALLOWED_IPS }} endpoint ${{ secrets.WIREGUARD_ENDPOINT }} | |
- run: sudo ip link set up dev wg0 | |
- uses: actions/checkout@v3 | |
- name: Deploy | |
uses: WyriHaximus/github-action-helm3@v3 | |
with: | |
exec: echo '${{ secrets.VALUES_YAML_HOME_SYSTEM_FEATURE }}' | helm upgrade akops-home ./deploy/backend --install --wait --atomic --values - | |
kubeconfig: '${{ secrets.K8S_CONF_AKOP_ONLINE }}' | |