Merge pull request #141 from ADORSYS-GIS/130-create-the-transaction-h… #39
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: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
packages: write | |
contents: read | |
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@v3 | |
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 clean package -DskipTests | |
- name: Verify JAR File Exists | |
run: | | |
if [ ! -f ./online-banking-app/target/online-banking-app-0.1-SNAPSHOT.jar ]; then | |
echo "JAR file not found!" && exit 1 | |
fi | |
- name: Log in to GHCR | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_PAT }} | |
- name: Build Docker image | |
run: | | |
docker build -t ghcr.io/adorsys-gis/webank-online-banking:${{ github.sha }} . | |
- name: Push Docker image to GHCR | |
run: | | |
docker push ghcr.io/adorsys-gis/webank-online-banking:${{ github.sha }} | |