Skip to content

Commit 293b43c

Browse files
committed
Add actions
1 parent 428c715 commit 293b43c

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/ci.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- bruno/**
7+
- .run/**
8+
9+
jobs:
10+
push:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
17+
- name: Set up JDK 21
18+
uses: actions/setup-java@v4
19+
with:
20+
java-version: '21'
21+
distribution: 'temurin'
22+
23+
- name: Build
24+
run: ./gradlew clean build
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Login to DockerHub Registry
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKERHUB_USERNAME }}
36+
password: ${{ secrets.DOCKERHUB_TOKEN }}
37+
38+
- name: Build and push
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: .
42+
platforms: linux/amd64,linux/arm64
43+
push: true
44+
tags: "${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:${{ github.sha }},${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:latest"
45+
46+
- name: Create staging
47+
if: github.ref == 'refs/heads/main'
48+
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:staging ${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:latest
49+
50+
- name: Generate summary
51+
run: |
52+
echo "Tag: ${{ github.sha }}" >> $GITHUB_STEP_SUMMARY

.github/workflows/release.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Login to DockerHub Registry
14+
uses: docker/login-action@v3
15+
with:
16+
username: ${{ secrets.DOCKERHUB_USERNAME }}
17+
password: ${{ secrets.DOCKERHUB_TOKEN }}
18+
19+
- name: Create release
20+
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:release ${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:staging
21+
22+
- name: Create tag
23+
run: docker buildx imagetools create -t ${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:${{ github.ref_name }} ${{ secrets.DOCKERHUB_USERNAME }}/jzhistory:staging

0 commit comments

Comments
 (0)