Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sanguine6660 committed Dec 13, 2023
0 parents commit 6acb6e8
Show file tree
Hide file tree
Showing 16 changed files with 1,870 additions and 0 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Gradle Test, Build and GitHub Release

on:
push:
branches:
- main

jobs:
build:
name: Test, Build and Release on GitHub
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 17
distribution: 'temurin'

# TODO: publishing to maven repo
- name: Build and Test
run: ./gradlew licenseFormat test build

- name: Get Old Release Tag
id: get_old_release
run: |
OLD_TAG=$(curl -s -H "Authorization: token ${{ secrets.DEPLOY_KEY }}" \
"https://api.github.com/repos/${{ github.repository }}/releases" | \
jq -r '.[0].tag_name')
if [ -z "$OLD_TAG" ] || [ "$OLD_TAG" = "null" ]; then
OLD_TAG="v1.0-SNAPSHOT"
fi
echo "Old release tag: $OLD_TAG"
echo "::set-output name=old_tag::$OLD_TAG"
env:
RELEASE_TOKEN: ${{ secrets.DEPLOY_KEY }}
GITHUB_REPOSITORY: ${{ github.repository }}

- name: Get Old Release ID
id: get_old_release_id
run: |
OLD_ID=$(curl -s -H "Authorization: token ${{ secrets.DEPLOY_KEY }}" \
"https://api.github.com/repos/${{ github.repository }}/releases" | \
jq -r '.[0].id')
echo "Old release tag: $OLD_ID"
echo "::set-output name=old_id::$OLD_ID"
env:
RELEASE_TOKEN: ${{ secrets.DEPLOY_KEY }}
GITHUB_REPOSITORY: ${{ github.repository }}

- name: Delete Old Release
if: steps.get_old_release.outputs.old_tag != ''
run: |
curl -X DELETE \
-H "Authorization: token ${{ secrets.DEPLOY_KEY }}" \
"https://api.github.com/repos/${{ github.repository }}/releases/${{ steps.get_old_release_id.outputs.old_id }}"
env:
RELEASE_TOKEN: ${{ secrets.DEPLOY_KEY }}

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.DEPLOY_KEY }}
with:
tag_name: ${{ steps.get_old_release.outputs.old_tag }}
release_name: Release ${{ steps.get_old_release.outputs.old_tag }}
draft: false
prerelease: false

- name: Upload Artifacts
id: upload-artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts
path: out/*.jar

- name: Upload JARs as Release Assets
id: upload-jars
run: |
for jar in out/*.jar; do
curl -X POST \
-H "Authorization: token ${{ secrets.DEPLOY_KEY }}" \
-H "Content-Type: application/java-archive" \
--data-binary @$jar \
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ steps.create_release.outputs.id }}/assets?name=$(basename $jar)"
done
39 changes: 39 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
16 changes: 16 additions & 0 deletions HEADER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Copyright (c) 2023 - present | sanguine6660 <sanguine6660@gmail.com>
Copyright (c) 2023 - present | izanagicraft.com <contact@izanagicraft.com>
Copyright (c) 2023 - present | izanagicraft.com team and contributors

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Loading

0 comments on commit 6acb6e8

Please sign in to comment.