From 1703c03725537b974552614c0e90e4f1cbd305dd Mon Sep 17 00:00:00 2001 From: DaniDipp Date: Fri, 12 Apr 2024 17:16:08 +0000 Subject: [PATCH] add deployment workflow --- .github/workflows/deploy.yml | 56 ++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 000000000..d20525d7b --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,56 @@ +name: Make Release +on: + workflow_dispatch: + +jobs: + build_jar: + name: Build Jar + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'adopt' + cache: maven + - name: Build with Maven + run: mvn --batch-mode --update-snapshots verify + - name: Rename jar + run: mv target/*-All.jar JMusicBot-Snapshot-All.jar + - name: Upload jar + uses: actions/upload-artifact@v3 + with: + name: jar + path: JMusicBot-Snapshot-All.jar + if-no-files-found: error + deploy: + name: Deploy Docker + runs-on: ubuntu-latest + needs: build_jar + steps: + - name: Download a Build Artifact + uses: actions/download-artifact@v3.0.0 + with: + name: jar + path: ./target + - name: Show Artifacts + run: ls -R + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker + uses: docker/login-action@v2 + with: + registry: ${{ secrets.DOCKER_REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Deploy to Docker + uses: docker/build-push-action@v5 + with: + tag_with_ref: false + tags: ${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot:latest + push: true + - name: Trigger Watchtower via curl + run: | + curl -L -I -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" "${{ secrets.WATCHTOWER_URL }}" \ No newline at end of file