chore: test ci (#1)

Co-authored-by: Aleksandr Chikovani <a@justrp.ru>
This commit is contained in:
Alexander Chikovany 2023-08-26 20:19:50 -04:00 committed by GitHub
parent 822e2e3bbb
commit fe130f52c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 75 additions and 4 deletions

61
.github/workflows/docker-publish.yml vendored Normal file
View file

@ -0,0 +1,61 @@
name: Publish docker image
on:
push:
branches: [ development, release-* ]
jobs:
build_and_publish:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: docker://ghcr.io/codfish/semantic-release-action@sha256:4675eae74abbabc869298ca798833fef291ce30fb9edfac76787746e7d9d3904
id: semantic
with:
branches: |
[
'release-*',
{
name: 'development',
prerelease: true
}
]
#dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: .
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.semantic.outputs.release-version }}
labels: ${{ steps.meta.outputs.labels }}
- name: Publish tag
uses: actions-ecosystem/action-push-tag@v1
with:
tag: ${{ steps.semantic.outputs.release-version }}
outputs:
version: ${{ steps.semantic.outputs.release-version }}

View file

@ -1,10 +1,8 @@
name: Java build name: Java test build
on: on:
push:
branches: [ main ]
pull_request: pull_request:
branches: [ main ] branches: [ development, release/** ]
jobs: jobs:
build: build:

12
Dockerfile Normal file
View file

@ -0,0 +1,12 @@
ENV WORKDIR /app
ENV PORT 8080
ENV VERSION undefined
FROM eclipse-temurin@sha256:039f727ed86402f37524b5d01a129947e2f061d5856901d07d73a454e689bb13 AS builder
WORKDIR $WORKDIR
COPY . .
RUN ./gradlew build -x test -Pversion=$VERSION
FROM eclipse-temurin@sha256:e90e0d654765ab3ae33f5c5155daafa4a907d0d738ce98c3be8f402a8edcee2b
WORKDIR $WORKDIR
COPY --from=builder $APP_HOME/build/libs/*jar .