forked from AtlasOfLivingAustralia/specieslist-webapp
-
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.
- Loading branch information
1 parent
e83bcbf
commit 6be493b
Showing
2 changed files
with
92 additions
and
0 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,59 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
|
||
build: | ||
|
||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout project sources | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '11' | ||
distribution: 'temurin' | ||
|
||
- name: Setup Gradle | ||
uses: gradle/gradle-build-action@v2 | ||
|
||
- name: Run build with Gradle Wrapper | ||
run: ./gradlew build | ||
|
||
- name: Upload war | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: package | ||
path: build/libs | ||
|
||
- name: Log in to the Container registry | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: ghcr.io/${{ github.repository }} | ||
|
||
- name: Build and push Docker image | ||
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} |
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,33 @@ | ||
#!/bin/bash | ||
|
||
# Get the last GitHub tag version | ||
last_tag=$(git describe --tags --abbrev=0) | ||
|
||
major=$(echo "$last_tag" | cut -d. -f1) | ||
minor=$(echo "$last_tag" | cut -d. -f2) | ||
patch=$(echo "$last_tag" | cut -d. -f3) | ||
|
||
new_patch=$((patch + 1)) | ||
|
||
echo | ||
read -p "Current version: $last_tag. Enter the new version (or press Enter for $major.$minor.$new_patch): " new_version_input | ||
|
||
if [ -z "$new_version_input" ]; then | ||
new_version="$major.$minor.$new_patch" | ||
else | ||
new_version="$new_version_input" | ||
fi | ||
|
||
# Validate the new version format (assuming it follows semantic versioning) | ||
if ! [[ "$new_version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | ||
echo "Invalid version format. Please use semantic versioning (e.g., 1.2.3)." | ||
exit 1 | ||
fi | ||
|
||
echo "Updating to version $new_version" | ||
|
||
# Create a new tag | ||
git tag "$new_version" | ||
git push origin "$new_version" | ||
|
||
echo "Tag $new_version created and pushed." |