Skip to content

Commit

Permalink
feat: add auto publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Morazzer committed Sep 14, 2024
1 parent 6b8d2e4 commit 1391346
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Publish
on:
push:
tags:
- v**
permissions:
contents: write
jobs:
publish:
name: Publish Entities
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v3
with:
distribution: corretto
java-version: 21
cache: gradle
- name: Make executable
run: |
chmod +x ./gradlew
- name: Build
env:
USERNAME: ${{ secrets.USER }}
TOKEN: ${{ secrets.TOKEN }}
run: ./gradlew test build version publish createChangelog
- name: Get version
id: version
run: |
echo "version=$(cat version.txt)" >> $GITHUB_OUTPUT
- name: Create Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
version=${{ steps.version.outputs.version }}
body=$(cat CHANGELOG.md)
gh release create --draft "v$version" --title "v$version" --notes "$body"
- name: Upload artifact
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
run: |
tag=${{ github.event.ref }}
version=${{ steps.version.outputs.version }}
gh release upload "v$version" "build/libs/entities-$version.jar"
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "dev.morazzer.cookies"
version = "0.0.1"
version = "0.2.0"

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tasks {
if (it.size > 1) {
it[1].objectId
} else {
git.log().call().first().toObjectId()
git.log().call().last().toObjectId()
}
}

Expand Down
3 changes: 3 additions & 0 deletions gradle/CHANGELOG_HEADER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# v$VERSION$

## Changes

0 comments on commit 1391346

Please sign in to comment.