Skip to content

Commit

Permalink
fix: correct workflow indentation
Browse files Browse the repository at this point in the history
build: add matrix for multiple java versions
  • Loading branch information
AnthonyPorthouse committed Nov 4, 2023
1 parent 180a2a6 commit 6307dcc
Showing 1 changed file with 69 additions and 61 deletions.
130 changes: 69 additions & 61 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,69 +3,77 @@ on:
branches:
- main

permissions:
contents: write
pull-requests: write
packages: write
permissions:
contents: write
pull-requests: write
packages: write

name: Create Release
name: Create Release

jobs:
release-please:
runs-on: ubuntu-latest
jobs:
release-please:
runs-on: ubuntu-latest

outputs:
releases_created: ${{ steps.release-please.outputs.releases_created }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
major: ${{ steps.release-please.outputs.major }}
minor: ${{ steps.release-please.outputs.minor }}
patch: ${{ steps.release-please.outputs.patch }}
sha: ${{ steps.release-please.outputs.sha }}
outputs:
releases_created: ${{ steps.release-please.outputs.releases_created }}
tag_name: ${{ steps.release-please.outputs.tag_name }}
major: ${{ steps.release-please.outputs.major }}
minor: ${{ steps.release-please.outputs.minor }}
patch: ${{ steps.release-please.outputs.patch }}
sha: ${{ steps.release-please.outputs.sha }}

steps:
- uses: google-github-actions/release-please-action@v3
id: release-please
with:
release-type: simple
package-name: fabric-server
steps:
- uses: google-github-actions/release-please-action@v3
id: release-please
with:
release-type: simple
package-name: fabric-server

build:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.releases_created }}

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/anthonyporthouse/fabric-server
tags: |
type=raw,value=latest
type=raw,value=${{needs.release-please.outputs.major}}.${{needs.release-please.outputs.minor}}.${{needs.release-please.outputs.patch}}
type=raw,value=${{needs.release-please.outputs.major}}.${{needs.release-please.outputs.minor}}
type=raw,value=${{needs.release-please.outputs.major}}
type=sha
- name: Build
uses: docker/build-push-action@v5
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: |
linux/amd64
linux/arm64
build:
runs-on: ubuntu-latest
needs: release-please
if: ${{ needs.release-please.outputs.releases_created }}
strategy:
matrix:
java-version: [17, 16, 11, 8]

name: Build ${{ matrix.java-version }}

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
ghcr.io/anthonyporthouse/fabric-server
tags: |
type=raw,value=latest,enable=${{ matrix.java-version == 17 }}
type=raw,value=java${{matrix.java-version}}-${{needs.release-please.outputs.major}}.${{needs.release-please.outputs.minor}}.${{needs.release-please.outputs.patch}}
type=raw,value=java${{matrix.java-version}}-${{needs.release-please.outputs.major}}.${{needs.release-please.outputs.minor}}
type=raw,value=java${{matrix.java-version}}-${{needs.release-please.outputs.major}}
type=raw,value=java${{matrix.java-version}}
- name: Build
uses: docker/build-push-action@v5
with:
context: .
build-args: |
JAVA_VERSION:${{matrix.java-version}}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: |
linux/amd64
linux/arm64

0 comments on commit 6307dcc

Please sign in to comment.