Prepared for 3.0.6 #145
This file contains 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: Production Release | |
on: | |
push: | |
branches: | |
- 'main' | |
tags: | |
- '*' | |
# Cancel concurrent runs | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
PROJ_NAME: nexus-command | |
DOCKER_IMAGE: savantly/nexus-command | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v2 | |
# Caching | |
- name: Cache Maven deps | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2 | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
# Setup Environments | |
- name: Setup Java | |
uses: actions/[email protected] | |
with: | |
distribution: 'temurin' | |
java-version: '17' # The JDK version to make available on the path. | |
java-package: jdk # (jre, jdk, or jdk+fx) - defaults to jdk | |
architecture: x64 # (x64 or x86) - defaults to x64 | |
# Install artifacts locally for the docker build | |
# Also runs unit/integration tests | |
- name: Install artifacts locally | |
run: mvn install | |
# Cache Docker layers | |
- name: Cache Docker layers | |
uses: actions/cache@v2 | |
with: | |
path: /tmp/.buildx-cache | |
key: ${{ runner.os }}-buildx-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-buildx- | |
- name: Log in to Docker Hub | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 | |
with: | |
images: ${{ env.DOCKER_IMAGE }} | |
tags: | | |
type=schedule | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=ref,event=branch | |
type=ref,event=pr | |
type=sha | |
type=raw,value=latest,enable={{is_default_branch}} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671 | |
env: | |
SPRING_PROFILES_ACTIVE: POSTGRESQL | |
with: | |
context: . | |
file: ./docker/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |