forked from jagrosh/MusicBot
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (94 loc) · 3.58 KB
/
deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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: Test dokcer credentials with curl
run: curl -X GET -u ${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }} -L https://${{ secrets.DOCKER_REGISTRY }}/v2/mother-mouse-musicbot/tags/list
- 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 QEMU
# uses: docker/setup-qemu-action@v3
# - name: Docker Setup Buildx
# uses: docker/[email protected]
# with:
# buildkitd-flags: --debug
# - name: Set up containerd
# uses: crazy-max/ghaction-setup-containerd@v2
# - name: Build Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# platforms: linux/amd64
# tags: ${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot:latest
# outputs: type=oci,dest=/tmp/image.tar
# - name: Import image in containerd
# run: |
# sudo ctr i import --base-name ${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot --digests --all-platforms /tmp/image.tar
# - name: Push image with containerd
# run: |
# sudo ctr --debug i push --user "${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}" ${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot:latest
# - name: Docker Meta
# uses: docker/metadata-action@v5
# with:
# images: ${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot
# tags: type=sha
# - 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: ${{ steps.meta.outputs.tags }}
# tags: ${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot:latest
# context: .
# push: true
# cache-from: 'type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot:buildcache'
# cache-to: 'type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/mother-mouse-musicbot:buildcache,mode=max'
- name: Deploy to Registry
uses: mr-smithers-excellent/docker-build-push@v6
with:
image: mother-mouse-musicbot
tags: latest
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Trigger Watchtower via curl
run: |
curl -L -I -H "Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" "${{ secrets.WATCHTOWER_URL }}"