modify pom.xml #14
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: Build and Push Docker Image | |
on: | |
push: | |
branches: | |
- docker | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '21' | |
distribution: 'liberica' | |
cache: maven | |
- name: run echo something | |
run: | | |
echo github.workspace:${{ github.workspace }} | |
echo github.repository:${{ github.repository }} | |
echo github.ref:${{ github.ref }} | |
echo version:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout ) | |
echo artifactId:$(mvn help:evaluate -Dexpression=project.artifactId -DforceStdout -q ) | |
echo GITHUB_TOKEN:${{ secrets.GITHUB_TOKEN }} | |
echo MY_GH_SECRET_TOKEN:${{ secrets.MY_GH_SECRET_TOKEN }} | |
- name: Build with Maven | |
run: cd java && mvn -B package -P github -X | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64 | |
context: ./nodejs-project | |
push: true | |
tags: ghcr.io/${{ github.repository }}:latest | |