12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- name: Java
- on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
- jobs:
- build:
- name: Build
- runs-on: ubuntu-latest
- steps:
- - name: Check out code
- uses: actions/checkout@v4
- - name: Set up JDK 1.8
- uses: actions/setup-java@v2
- with:
- version: 1.8
- jdk: true
- - name: Dump Github context
- env:
- GITHUB_CONTEXT: '${{ toJSON(github) }}'
- run: |
- echo " hello ${{ github.event.commits[0].id }}"
- - name: Cache local Maven repository
- uses: actions/cache@v2
- with:
- path: ~/.m2/repository
- key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
- restore-keys: |
- ${{ runner.os }}-maven-
- - uses: actions/cache@v2
- with:
- path: |
- ~/.gradle/caches
- ~/.gradle/wrapper
- key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- restore-keys: |
- ${{ runner.os }}-gradle-
- - name: Build with Gradle
- run: |
- chmod +x gradlew
- ./gradlew build
-
- - name: Extract files from jar
- run: |
- mkdir -p build/libs
-
- - name: build docker image and push
- env:
- DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
- DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
- DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
- run: |
- docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} ${{ secrets.DOCKER_REGISTRY }}
-
- - name: set buildx
- uses: crazy-max/ghaction-docker-buildx@v1
- with:
- buildx-version: latest
- - name: push docker image
- run: |
- cd build && \
- fullCommit="${{ github.event.commits[0].id }}" && \
- docker buildx build \
- --platform linux/amd64,linux/arm64,linux/arm/v7 \
- --tag ${{ secrets.DOCKER_REGISTRY }}/{{ github.repository.owner.login }}/{{ github.repository.name }}:${{ fullCommit: 0:7 }} \
- --progress=plain \
- --file Dockerfile . \
- --output "type=image,push=true"
- --push
- - name: deploy to docker
-
|