Skip to content

Commit

Permalink
Merge pull request #24 from yvasyliev/3.0.0
Browse files Browse the repository at this point in the history
v3.0.0
  • Loading branch information
yvasyliev authored Nov 14, 2023
2 parents 5519fb8 + e376025 commit 386a604
Show file tree
Hide file tree
Showing 154 changed files with 5,014 additions and 1,468 deletions.
26 changes: 13 additions & 13 deletions .github/workflows/build-maven-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ jobs:
cache: maven
- name: Build with Maven
env:
reddit.subreddit: ${{ secrets.REDDIT_SUBREDDIT }}
reddit.client.id: ${{ secrets.REDDIT_CLIENT_ID }}
reddit.client.secret: ${{ secrets.REDDIT_CLIENT_SECRET }}
reddit.password: ${{ secrets.REDDIT_PASSWORD }}
reddit.username: ${{ secrets.REDDIT_USERNAME }}
spring.jpa.hibernate.ddl-auto: ${{ vars.SPRING_JPA_HIBERNATE_DDL_AUTO }}
telegram.admin.id: ${{ secrets.TELEGRAM_ADMIN_ID }}
telegram.bot.token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
telegram.bot.username: ${{ secrets.TELEGRAM_BOT_USERNAME }}
telegram.channel.id: ${{ secrets.TELEGRAM_CHANNEL_ID }}
telegram.channel.name: ${{ secrets.TELEGRAM_CHANNEL_NAME }}
telegram.chat.id: ${{ secrets.TELEGRAM_CHAT_ID }}
telegram.schedule.posting.enabled: ${{ vars.TELEGRAM_SCHEDULE_POSTING_ENABLED }}
REDDIT_SUBREDDIT: ${{ secrets.REDDIT_SUBREDDIT }}
REDDIT_CLIENT_ID: ${{ secrets.REDDIT_CLIENT_ID }}
REDDIT_CLIENT_SECRET: ${{ secrets.REDDIT_CLIENT_SECRET }}
REDDIT_PASSWORD: ${{ secrets.REDDIT_PASSWORD }}
REDDIT_USERNAME: ${{ secrets.REDDIT_USERNAME }}
SPRING_JPA_HIBERNATE_DDL_AUTO: ${{ vars.SPRING_JPA_HIBERNATE_DDL_AUTO }}
TELEGRAM_ADMIN_ID: ${{ secrets.TELEGRAM_ADMIN_ID }}
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TELEGRAM_BOT_USERNAME: ${{ secrets.TELEGRAM_BOT_USERNAME }}
TELEGRAM_CHANNEL_ID: ${{ secrets.TELEGRAM_CHANNEL_ID }}
TELEGRAM_CHANNEL_NAME: ${{ secrets.TELEGRAM_CHANNEL_NAME }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TELEGRAM_SCHEDULE_POSTING_ENABLED: ${{ vars.TELEGRAM_SCHEDULE_POSTING_ENABLED }}
run: mvn package
103 changes: 100 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,112 @@ name: Release
on:
workflow_dispatch:
inputs:
version:
description: "Release version"
required: true
release_type:
description: "Release type"
type: choice
options:
- patch
- minor
- major
- provided

env:
JAR_NAME_TEMPLATE: reddit-telegram-repeater-*-shaded.jar
TAG: v${{ github.event.inputs.version }}

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
cache: maven
- name: Run test
run: mvn test
env:
spring.jpa.hibernate.ddl-auto: create-drop
telegram.admin.id: ${{ secrets.telegram.admin.id }}
telegram.bot.token: ${{ secrets.test.telegram.bot.token }}
telegram.channel.id: ${{ secrets.test.telegram.channel.id }}
telegram.chat.id: ${{ secrets.test.telegram.chat.id }}
telegram.schedule.posting.enabled: false


release:
runs-on: ubuntu-latest
needs: test
steps:
- name: Install XMLStarlet
run: sudo apt-get install xmlstarlet
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
cache: maven
- name: Get current version
id: get_current_version
run: |
current_version=$(xmlstarlet sel -N pom=http://maven.apache.org/POM/4.0.0 -t -v "/pom:project/pom:version" pom.xml)
echo "current_version=$current_version"
echo "VERSION=$current_version" >> $GITHUB_ENV
- name: Validate current version
if: github.event.inputs.release_type != 'provided'
run: |
echo ${{ env.VERSION }} | grep -qoP "^\d+\.\d+\.\d+((\.|-).+)?$" || (echo "::error::Unexpected artifact version found in pom.xml: ${{ env.VERSION }}. Expected format: x.y.z*" && exit 1)
- name: Increment patch version
if: github.event.inputs.release_type == 'patch'
run: |
patch_version=$(echo ${{ env.VERSION }} | grep -oP "^\d+\.\d+\.\K\d+")
echo "patch_version=$patch_version"
incremented_patch_version=$((patch_version + 1))
echo "incremented_patch_version=$incremented_patch_version"
echo "VERSION=$(echo ${{ env.VERSION }} | grep -oP '^\d+\.\d+\.')$incremented_patch_version" >> $GITHUB_ENV
- name: Increment minor version
if: github.event.inputs.release_type == 'minor'
run: |
minor_version=$(echo ${{ env.VERSION }} | grep -oP "^\d+\.\K\d+")
echo "minor_version=$minor_version"
incremented_minor_version=$((minor_version + 1))
echo "incremented_minor_version=$incremented_minor_version"
echo "VERSION=$(echo ${{ env.VERSION }} | grep -oP '^\d+\.')$incremented_minor_version.0" >> $GITHUB_ENV
- name: Increment major version
if: github.event.inputs.release_type == 'major'
run: |
major_version=$(echo ${{ env.VERSION }} | grep -oP "^\d+")
echo "major_version=$major_version"
incremented_major_version=$((major_version + 1))
echo "incremented_major_version=$incremented_major_version"
echo "VERSION=$incremented_major_version.0.0" >> $GITHUB_ENV
- name: Print new version
run: echo "new_version=${{ env.VERSION }}"
- name: Update pom.xml version
run: xmlstarlet ed -P -L -N pom=http://maven.apache.org/POM/4.0.0 -u "/pom:project/pom:version" -v ${{ env.VERSION }} pom.xml
- name: Set Tag name
run: echo "TAG=v${{ env.VERSION }}" >> $GITHUB_ENV
- name: Commit & Push changes
run: |
git config user.email "[email protected]"
git config user.name "github-actions"
git add pom.xml
git commit -m "${{ env.TAG }}"
git push
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG }}
release_name: ${{ env.TAG }}
draft: true
check_input:
runs-on: ubuntu-latest
steps:
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@
/target/
.idea
app_data.properties
*.log
*.log
*.db
*.gz
*.pid
Loading

0 comments on commit 386a604

Please sign in to comment.