Release v0.2.0 #1
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
# | |
# Copyright (c) 2023 Contributors to the Eclipse Foundation | |
# | |
# See the NOTICE file(s) distributed with this work for additional | |
# information regarding copyright ownership. | |
# | |
# This program and the accompanying materials are made available under the | |
# terms of the Eclipse Public License 2.0 which is available at | |
# http://www.eclipse.org/legal/epl-2.0 | |
# | |
# SPDX-License-Identifier: EPL-2.0 | |
# | |
name: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Tag to release' | |
required: true | |
type: string | |
latestTag: | |
description: 'Tag the Docker image as the latest' | |
required: true | |
type: boolean | |
default: true | |
run-name: Release ${{ github.event.inputs.tag }} | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Docker Tags | |
id: docker-tags | |
run: | | |
if [[ ! ${{ github.event.inputs.tag }} =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9]+)?$ ]]; then | |
echo "Tag format is invalid. Please use vX.Y.Z or vX.Y.Z-<qualifier>." | |
exit 1 | |
fi | |
selectedTag=${{ github.event.inputs.tag }} | |
version=${selectedTag#v} | |
if [[ ${{ github.event.inputs.latestTag }} == true ]]; then | |
tags=eclipsejifa/jifa:latest,eclipsejifa/jifa:${version} | |
else | |
tags=eclipsejifa/jifa:${version} | |
fi | |
echo "Docker Tags: $tags" | |
echo "::set-output name=tags::$tags" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.inputs.tag }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME}} | |
password: ${{ secrets.DOCKER_PASSWORD}} | |
- name: Build for amd64 | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./build.Dockerfile | |
tags: jifa-build:latest | |
platforms: linux/amd64 | |
load: true | |
build-args: | | |
GRADLE_ARGS="clean build -Declipse-mat-deps.os=linux -Declipse-mat-deps.arch=amd64" | |
push: false | |
- name: Copy build artifacts from image | |
run: | | |
rm -rf ./jifa-build | |
rm -rf ./jifa-artifacts | |
mkdir jifa-build | |
mkdir jifa-artifacts | |
docker create --name jifa-build jifa-build:latest | |
docker cp jifa-build:/workspace/server/build/dependency jifa-build/amd64 | |
docker cp jifa-build:/workspace/server/build/distributions/jifa.zip jifa-artifacts/jifa-linux-amd64.zip | |
docker rm jifa-build | |
- name: Build for arm64 | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./build.Dockerfile | |
tags: jifa-build:latest | |
platforms: linux/amd64 | |
load: true | |
build-args: | | |
GRADLE_ARGS="clean build -x test -Declipse-mat-deps.os=linux -Declipse-mat-deps.arch=aarch64" | |
push: false | |
- name: Copy build artifacts from image | |
run: | | |
docker create --name jifa-build jifa-build:latest | |
docker cp jifa-build:/workspace/server/build/dependency jifa-build/arm64 | |
docker cp jifa-build:/workspace/server/build/distributions/jifa.zip jifa-artifacts/jifa-linux-arm64.zip | |
docker rm jifa-build | |
- name: Build and push final image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: ./final.Dockerfile | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.docker-tags.outputs.tags }} | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.event.inputs.tag }} | |
release_name: Release ${{ github.event.inputs.tag }} | |
draft: false | |
prerelease: false | |
- uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./jifa-artifacts/jifa-linux-amd64.zip | |
asset_name: jifa-linux-amd64.zip | |
asset_content_type: application/zip | |
- uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./jifa-artifacts/jifa-linux-arm64.zip | |
asset_name: jifa-linux-arm64.zip | |
asset_content_type: application/zip |