vnobo is Build Boot Image Actions #171
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
name: Gradle Build Image | |
run-name: ${{ github.actor }} is Build Boot Image Actions | |
on: | |
push: | |
branches: | |
- 'main' | |
- 'dev' | |
tags: | |
- 'v*' | |
release: | |
types: [ created ] | |
env: | |
GITHUB_REGISTRY: ghcr.io/${{ github.actor }} | |
DOCKER_REGISTRY: docker.io/alexbob | |
tags: | | |
type=semver,pattern={{version}},value=v0.0.4 | |
type=semver,pattern={{major}}.{{minor}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | |
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }} | |
type=ref,event=tag | |
jobs: | |
boot-build-image: | |
runs-on: ubuntu-latest | |
services: | |
registry: | |
image: registry:2 | |
ports: | |
- 5000:5000 | |
permissions: | |
contents: read | |
packages: write | |
env: | |
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: gradle/actions/wrapper-validation@v4 | |
- name: Set up java 21 for x64 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'liberica' | |
cache: 'gradle' | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: network=host | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Execute Gradle Plate bootBuildImage | |
run: | | |
chmod +x ./gradlew | |
./gradlew bootBuildImage --imagePlatform=linux/amd64 --network=host --publishImage --scan | |
./gradlew bootBuildImage --imagePlatform=linux/arm64 --network=host --publishImage --scan | |
- name: Inspect | |
run: | | |
docker buildx imagetools inspect localhost:5000/plate-oauth2:latest | |
docker buildx imagetools inspect localhost:5000/plate-platform:latest | |
- name: Log into registry ${{ env.GITHUB_REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.GITHUB_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.PAGK_TOKEN }} | |
- name: Log into registry ${{ env.DOCKER_REGISTRY }} | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Extract platform metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=true | |
images: | | |
${{ env.GITHUB_REGISTRY }}/plate-platform | |
${{ env.DOCKER_REGISTRY }}/plate-platform | |
tags: ${{ env.tags }} | |
- name: Build and Push Platform | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: ./boot/platform | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Upload Platform Image to Registry | |
run: | | |
echo "Upload images ${{ steps.meta.outputs.tags }} to registry." | |
echo "Upload labels ${{ steps.meta.outputs.labels }} to registry" | |
- name: Extract oauth2 metadata (tags, labels) for Docker | |
id: oauth2 | |
uses: docker/metadata-action@v5 | |
with: | |
flavor: | | |
latest=true | |
images: | | |
${{ env.GITHUB_REGISTRY }}/plate-oauth2 | |
${{ env.DOCKER_REGISTRY }}/plate-oauth2 | |
tags: ${{ env.tags }} | |
- name: Build and Push Oauth2 | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64,linux/arm64 | |
context: ./boot/oauth2 | |
push: ${{ github.event_name != 'pull_request' }} | |
tags: ${{ steps.oauth2.outputs.tags }} | |
labels: ${{ steps.oauth2.outputs.labels }} | |
- name: Upload Oauth2 Image to Registry | |
run: | | |
echo "Upload images ${{ steps.oauth2.outputs.tags }} to registry." | |
echo "Upload labels ${{ steps.oauth2.outputs.labels }} to registry" |