Skip to content

Merge pull request #601 from jhipster/dependabot/npm_and_yarn/braces-… #58

Merge pull request #601 from jhipster/dependabot/npm_and_yarn/braces-…

Merge pull request #601 from jhipster/dependabot/npm_and_yarn/braces-… #58

#
# Copyright the original author or authors from the JHipster project.
#
# This file is part of the JHipster project, see https://www.jhipster.tech/
# for more information.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Publish Containers
on:
push:
branches:
- main
# Publish semver tags as releases.
tags:
- 'v*.*.*'
jobs:
pipeline:
name: JHipster Registry Docker
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]') && !contains(github.event.pull_request.title, '[skip ci]') && !contains(github.event.pull_request.title, '[ci skip]')"
timeout-minutes: 40
steps:
- uses: actions/checkout@v2
- name: 'Setup java'
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '11'
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'TOOLS: docker version'
run: docker version
- name: Publish to GitHub Container Registry
run: ./mvnw -ntp verify -DskipTests -Pprod jib:build -Dimage=ghcr.io/${{ github.repository }}:main
- name: 'DOCKER: list image'
run: docker images
- name: 'DOCKER: start container'
run: docker run --name jhipster-registry -p 8761:8761 -d -t ghcr.io/${{ github.repository }}:main
- name: 'DOCKER: wait 30sec'
run: sleep 30
- name: 'DOCKER list containers'
run: docker container ps -a
- name: 'DOCKER: see logs'
run: docker container logs jhipster-registry
- name: 'DOCKER: curl 8761'
run: curl -v http://localhost:8761
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
with:
images: jhipster/jhipster-registry
tags: |
type=semver,pattern=v{{version}}
- name: Login to Docker Registry
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: ${{env.DOCKERHUB_USERNAME != '' && startsWith(github.ref, 'refs/tags/v')}}
uses: docker/login-action@v1
id: login-hub
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Publish to Docker Hub
if: ${{steps.login-hub.outcome == 'success'}}
run: ./mvnw -ntp verify -DskipTests -Pprod jib:build -Dimage=jhipster/jhipster-registry -Djib.to.tags='${{ steps.meta.outputs.version }},latest'