modified worflow to test image is pushed to ghcr #4
Workflow file for this run
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 (Testing) | |
on: | |
push: | |
branches: ['test-worflow-for-image'] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
- name: Cache Maven packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2 | |
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} | |
restore-keys: ${{ runner.os }}-m2 | |
- name: Set up Maven settings.xml | |
run: | | |
mkdir -p ~/.m2 | |
echo "<settings> | |
<servers> | |
<server> | |
<id>github-webank</id> | |
<username>${{ github.actor }}</username> | |
<password>${{ secrets.WEBANK_ACCESS_TOKEN }}</password> | |
</server> | |
</servers> | |
</settings>" > ~/.m2/settings.xml | |
- name: Build JAR | |
run: mvn -f online-banking-app/pom.xml clean package -DskipTests | |
- name: Verify JAR File Exists | |
run: ls -l ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar | |
- name: Log in to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_PAT}} | |
- name: Build Docker image | |
run: | | |
docker build -t ghcr.io/adorsys-gis/webank-online-banking:latest . | |
- name: Push Docker image to GHCR | |
run: | | |
docker push ghcr.io/adorsys-gis/webank-online-banking:latest |