chore: add GitHub Actions CI/CD workflow #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| release: | |
| types: [ released ] | |
| jobs: | |
| build: | |
| name: Build [JVM] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Go | |
| uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: 'go.mod' | |
| - name: Build | |
| run: make build | |
| - name: Test | |
| run: make test | |
| docker-jvm: | |
| name: Docker | |
| runs-on: ubuntu-latest | |
| needs: | |
| - build | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Prepare version labels | |
| uses: k15g/action-version-labels@edge | |
| with: | |
| prefix: project | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Lowercase github.repository | |
| run: echo "IMAGE_NAME=`echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV} | |
| - name: Build and push [edge] | |
| run: | | |
| docker buildx build \ | |
| -t ghcr.io/${{ env.IMAGE_NAME }}:edge \ | |
| --platform linux/amd64,linux/arm64 \ | |
| --push . | |
| - name: Build and push [version] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| docker buildx build \ | |
| -t ghcr.io/${{ env.IMAGE_NAME }}:${{ env.PROJECT_VERSION }} \ | |
| --platform linux/amd64,linux/arm64 \ | |
| --push . | |
| - name: Build and push [latest] | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| docker buildx build \ | |
| -t ghcr.io/${{ env.IMAGE_NAME }}:latest \ | |
| --platform linux/amd64,linux/arm64 \ | |
| --push . |