Skip to content

Commit 05002d2

Browse files
committed
ci: replace drone ci with github action
1 parent f940454 commit 05002d2

File tree

5 files changed

+196
-28
lines changed

5 files changed

+196
-28
lines changed

.drone.yml

-28
This file was deleted.

.github/dependabot.yml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
- package-ecosystem: "" # See documentation for possible values
9+
directory: "/" # Location of package manifests
10+
schedule:
11+
interval: "weekly"

.github/semantic.yml

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Always validate the PR title AND all the commits
2+
titleAndCommits: true
3+
# Require at least one commit to be valid
4+
# this is only relevant when using commitsOnly: true or titleAndCommits: true,
5+
# which validate all commits by default
6+
anyCommit: true
7+
# Allow use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns")
8+
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
9+
allowMergeCommits: false
10+
# Allow use of Revert commits (eg on github: "Revert "feat: ride unicorns"")
11+
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
12+
allowRevertCommits: false

.github/workflows/build.yml

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
permissions:
6+
contents: write
7+
packages: write
8+
9+
jobs:
10+
backend:
11+
name: Backend
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- name: Setup Java
16+
uses: actions/setup-java@v4
17+
with:
18+
distribution: 'temurin'
19+
java-version: 21
20+
- name: Setup Gradle
21+
uses: gradle/actions/setup-gradle@v3
22+
- name: Artifact
23+
uses: actions/upload-artifact@v3
24+
with:
25+
name: rm-monitor
26+
path: ./build/libs
27+
28+
release:
29+
name: Release
30+
runs-on: ubuntu-latest
31+
if: github.event_name == 'push'
32+
needs: [ backend ]
33+
outputs:
34+
new_version: ${{ steps.should_push.outputs.new_version }}
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Set up Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: '20'
45+
46+
- name: Fetch Previous version
47+
id: get-previous-tag
48+
uses: actions-ecosystem/[email protected]
49+
50+
- name: mkdir
51+
run: |
52+
mkdir dist
53+
54+
- name: Download Artifact
55+
uses: actions/download-artifact@v3
56+
with:
57+
name: rm-monitor
58+
path: ./dist
59+
60+
- name: Release
61+
env:
62+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63+
run: yarn global add semantic-release @semantic-release/changelog && semantic-release
64+
65+
- name: Fetch Current version
66+
id: get-current-tag
67+
uses: actions-ecosystem/[email protected]
68+
69+
- name: Output New Version
70+
id: should_push
71+
run: |
72+
old_version=${{steps.get-previous-tag.outputs.tag}}
73+
new_version=${{steps.get-current-tag.outputs.tag }}
74+
75+
if [ "$old_version" != "$new_version" ]; then
76+
echo "new_version=$new_version" >> $GITHUB_OUTPUT
77+
else
78+
echo "new_version=" >> $GITHUB_OUTPUT
79+
fi
80+
81+
docker:
82+
runs-on: ubuntu-latest
83+
needs: [ release ]
84+
if: github.event_name == 'push' && needs.release.outputs.new_version != ''
85+
steps:
86+
- name: Checkout
87+
uses: actions/checkout@v4
88+
89+
- name: Set up Docker Buildx
90+
uses: docker/setup-buildx-action@v3
91+
92+
- name: Buildx Cache
93+
id: buildx-cache
94+
uses: docker/setup-buildx-action@v3
95+
with:
96+
driver-opts: name=gha
97+
98+
- name: Buildx Cache Load
99+
id: buildx-cache-load
100+
uses: docker/setup-buildx-action@v3
101+
with:
102+
driver-opts: name=gha
103+
action: load
104+
105+
- name: Login to Docker Hub
106+
if: github.event_name != 'pull_request'
107+
uses: docker/login-action@v3
108+
with:
109+
username: ${{ secrets.DOCKERHUB_USERNAME }}
110+
password: ${{ secrets.DOCKERHUB_PASSWORD }}
111+
112+
- name: Login to GHCR
113+
if: github.event_name != 'pull_request'
114+
uses: docker/login-action@v3
115+
with:
116+
registry: ghcr.io
117+
username: ${{ github.repository_owner }}
118+
password: ${{ secrets.GITHUB_TOKEN }}
119+
120+
- name: Docker Push
121+
uses: docker/build-push-action@v5
122+
if: github.event_name == 'push'
123+
with:
124+
context: .
125+
push: true
126+
platforms: linux/amd64
127+
tags: |
128+
scutrobot/rm-monitor:latest
129+
scutrobot/rm-monitor:${{ needs.release.outputs.new_version }}
130+
ghcr.io/scutrobot/rm-monitor:latest
131+
ghcr.io/scutrobot/rm-monitor:${{ needs.release.outputs.new_version }}
132+
build-args: |
133+
VERSION=${{ needs.release.outputs.new_version }}
134+
labels: |
135+
org.opencontainers.image.source=https://github.com/scutrobot/rm-monitor
136+
org.opencontainers.image.revision=${{ github.sha }}
137+
org.opencontainers.image.created=${{ github.event.head_commit.timestamp }}
138+
org.opencontainers.image.version=${{ needs.release.outputs.new_version }}
139+
org.opencontainers.image.title=rm-monitor ${{ needs.release.outputs.new_version }}
140+
org.opencontainers.image.description="robomaster monitor"
141+
org.opencontainers.image.licenses=AGPL-3.0
142+
cache-from: type=gha
143+
cache-to: type=gha,mode=max

.releaserc.json

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{
2+
"debug": true,
3+
"branches": [
4+
"+([0-9])?(.{+([0-9]),x}).x",
5+
"master",
6+
"next",
7+
"next-major",
8+
{
9+
"name": "beta",
10+
"prerelease": true
11+
},
12+
{
13+
"name": "alpha",
14+
"prerelease": true
15+
}
16+
],
17+
"plugins": [
18+
"@semantic-release/commit-analyzer",
19+
"@semantic-release/release-notes-generator",
20+
"@semantic-release/changelog",
21+
["@semantic-release/github", {
22+
"assets": [
23+
{"path": "dist/semantic-release", "name": "semantic-release-linux-amd64-${nextRelease.version}"},
24+
{"path": "dist/semantic-release.exe", "name": "semantic-release-windows-amd64-${nextRelease.version}.exe"},
25+
{"path": "dist/semantic-release-full", "name": "semantic-release-full-linux-amd64-${nextRelease.version}"},
26+
{"path": "dist/semantic-release-full.exe", "name": "semantic-release-full-windows-amd64-${nextRelease.version}.exe"}
27+
]
28+
}]
29+
]
30+
}

0 commit comments

Comments
 (0)