Skip to content

Commit

Permalink
add deployment workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniDipp committed Apr 13, 2024
1 parent d358be1 commit 5d5630b
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Deploy
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: Checkout
uses: actions/checkout@v4
- name: Download a Build Artifact
uses: actions/[email protected]
with:
name: jar
path: ./target/
- name: Show Artifacts
run: ls -R
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# - name: Move jar to Docker Buildx
# run: |
# mv JMusicBot-Snapshot-All.jar /tmp/$
- name: Login to Docker
uses: docker/login-action@v3
with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Deploy to Docker
uses: docker/build-push-action@v5
with:
tags: ${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot
context: .
push: true
- name: Trigger Watchtower via curl
run: |
curl -L -I -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" "${{ secrets.WATCHTOWER_URL }}"
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM eclipse-temurin:8
FROM eclipse-temurin:11-jre-alpine

WORKDIR /musicbot

Expand Down

0 comments on commit 5d5630b

Please sign in to comment.