-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve API & Deploy to BlueColored Repo
- Loading branch information
1 parent
88eaf41
commit e570137
Showing
11 changed files
with
249 additions
and
63 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Deploy to BlueColored Repo | ||
|
||
on: | ||
release: | ||
types: [ released ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
inputs: | ||
TAG_NAME: | ||
description: 'GitHub Tag Name (for comparing with project version)' | ||
required: true | ||
|
||
env: | ||
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- name: Check tag with project version | ||
run: | | ||
PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | ||
# Remove 'v' prefix from tag name | ||
TAG_VERSION=$(sed 's/^v//g' <<< "$TAG_NAME") | ||
if [ "$PROJECT_VERSION" != "$TAG_VERSION" ]; then | ||
echo "Project version ($PROJECT_VERSION) does not match tag ($TAG_VERSION)" | ||
exit 1 | ||
fi | ||
- name: Set up credentials | ||
shell: bash | ||
env: | ||
PASSWORD: ${{ secrets.MAVEN_SECRET }} | ||
run: echo "<settings><servers><server><id>bluecolored-releases</id><username>technicjelle</username><password>$PASSWORD</password></server></servers></settings>" > ~/.m2/settings.xml | ||
- name: Deploy | ||
run: mvn clean deploy |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 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 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* This file is part of MCUtils, licensed under the MPL2 License (MPL). | ||
* Please keep tabs on https://github.com/TechnicJelle/MCUtils for updates. | ||
* | ||
* Copyright (c) TechnicJelle <https://technicjelle.com> | ||
* Copyright (c) contributors | ||
* | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at https://mozilla.org/MPL/2.0/. | ||
*/ | ||
|
||
package com.technicjelle.MCUtils; | ||
|
||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import javax.imageio.ImageIO; | ||
import java.awt.image.BufferedImage; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.net.URL; | ||
|
||
/** | ||
* Utility functions for dealing with images | ||
*/ | ||
public class ImageUtils { | ||
private ImageUtils() { | ||
throw new IllegalStateException("Utility class"); | ||
} | ||
|
||
/** | ||
* Downloads an image from the given URL. | ||
* | ||
* @param url URL of the image | ||
* @return The image, or <code>null</code> if it could not be found, or the url was invalid | ||
*/ | ||
public static @Nullable BufferedImage downloadImage(@NotNull String url) { | ||
try { | ||
return downloadImage(new URL(url)); | ||
} catch (IOException e) { | ||
return null; | ||
} | ||
} | ||
|
||
/** | ||
* Downloads an image from the given URL. | ||
* | ||
* @param url URL of the image | ||
* @return The image, or <code>null</code> if it could not be found | ||
*/ | ||
public static @Nullable BufferedImage downloadImage(@NotNull URL url) { | ||
try ( | ||
InputStream in = url.openStream() | ||
) { | ||
return ImageIO.read(in); | ||
} catch (IOException e) { | ||
return null; | ||
} | ||
} | ||
} |
Oops, something went wrong.