Skip to content

chore: update docker login details #4

chore: update docker login details

chore: update docker login details #4

Workflow file for this run

name: Java CI with Maven
on:
push:
branches: [ "master" ]
paths-ignore:
- 'README.md'
pull_request:
branches: [ "master" ]
paths-ignore:
- 'README.md'
workflow_dispatch:
inputs:
latestTag:
description: Tag the image as 'latest'
type: boolean
default: false
testTag:
description: Tag the image as 'test'
type: boolean
default: false
jobs:
build:
name: Java 17 on ubuntu-latest
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
cache: maven
- name: Install BitcoinJ dependency
env:
BITCOINJ_TAG: 0.16.13-LIB
run: |
[[ "${BITCOINJ_TAG}" == "" ]] && (echo "BITCOINJ_TAG is not set" && exit 1)
echo "Cleaning directory $PWD/bitcoinj"
rm -rf $PWD/bitcoinj || (echo "Unable to delete dir $PWD/bitcoinj" && exit 1)
echo "Cloning repo https://github.com/natzei/bitcoinj.git"
git clone https://github.com/natzei/bitcoinj.git || (echo "Unable to clone https://github.com/natzei/bitcoinj.git" && exit 1)
echo "Checking out tag $BITCOINJ_TAG"
git -C $PWD/bitcoinj checkout $BITCOINJ_TAG || (echo "Unable to checkout branch $BITCOINJ_TAG" && exit 1)
echo "Installing BitcoinJ $BITCOINJ_TAG"
$PWD/bitcoinj/gradlew -p $PWD/bitcoinj publishToMavenLocal -x test || (echo "Unable to install bitcoinj" && exit 1)
echo "Cleaning directory $PWD/bitcoinj"
rm -rf $PWD/bitcoinj || (echo "Unable to delete dir $PWD/bitcoinj" && exit 1)
- name: Build with Maven
run: mvn -B -f xyz.balzaclang.balzac.parent/ -DwarName=balzac -U clean install
- name: Upload war artifact
uses: actions/upload-artifact@v3
with:
name: war-artifact
path: xyz.balzaclang.balzac.web/target/balzac.war
- name: Upload war artifact to Github Releases
uses: fnkr/github-action-ghr@v1
if: ${{ github.ref_type == 'tag' }}
env:
GHR_PATH: xyz.balzaclang.balzac.web/target/balzac.war
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish coverage metrics to Coveralls.io
run: mvn -B -f xyz.balzaclang.balzac.lib/ jacoco:report coveralls:report -DrepoToken=${{ secrets.COVERALLS_REPO_TOKEN }}
docker-build:
runs-on: ubuntu-latest
name: Build multi-arch docker images
needs: [build]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download war artifact
uses: actions/download-artifact@v3
with:
name: war-artifact
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ vars.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: balzaclang/balzac
tags: |
type=raw,value=latest,enable=${{ inputs.latestTag || false }}
type=raw,value=test,enable=${{ inputs.testTag || false }}
type=raw,value=test-{{sha}},enable=${{ inputs.testTag || false }}
type=raw,value={{tag}},enable=${{ github.ref_type == 'tag' }}
- name: Build Docker images
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: ${{ github.ref_type == 'tag' }}
build-args: war=balzac.war
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}