Skip to content

Update workflows on gitea to upload file #33

Update workflows on gitea to upload file

Update workflows on gitea to upload file #33

name: Pre-Builds dev versions
on:
push:
branches: [ dev ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: dev
- name: Set up JDK 21 temurin
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
cache: 'gradle'
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Read value from Properties-file
id: read_property
uses: Reedyuk/read-properties@v1.0.4
with:
path: './gradle.properties'
property: 'SBA_VERSION'
- name: Read value from Properties-file
id: read_property_min_mc_version
uses: Reedyuk/read-properties@v1.0.4
with:
path: './gradle.properties'
property: 'MIN_MC_VERSION'
- name: Read value from Properties-file
id: read_property_max_mc_version
uses: Reedyuk/read-properties@v1.0.4
with:
path: './gradle.properties'
property: 'MAX_MC_VERSION'
- name: Declare some variables
id: vars
shell: bash
run: |
echo "{branch}=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_STATE
echo "{sha_short}=$(git rev-parse --short HEAD)" >> $GITHUB_STATE
- name: Build with Gradle
run: ./gradlew
env:
OPTIMIZE_FOR_CI_CD: "1"
BUILD_NUMBER: ${{ github.run_id }}
GITHUB_ACTIONS_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
GITHUB_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
- uses: ncipollo/release-action@v1
with:
artifacts: "LICENSE,plugin/build/libs/*.jar"
tag: ${{ steps.read_property.outputs.value }}-dev
allowUpdates: true
prerelease: true
- name: Upload artifact to Gitea release
if: env.GITEA_ACTIONS == 'true'
run: |
curl -X POST https:/gitea.moyskleytech.com/api/v1/repos/boiscljo/SBA/releases/tags/${{ steps.read_property.outputs.value }}-dev/assets \
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
-F name="SBA-${{ steps.read_property.outputs.value }}.jar" \
-F attachment=@plugin/build/libs/SBA-${{ steps.read_property.outputs.value }}-all.jar
-o response.json
-w "%{http_code}\n"
- name: Publish to Modrinth (Beta)
uses: Kir-Antipov/mc-publish@v3.3
if: env.GITEA_ACTIONS == 'true'
with:
files: "*.jar"
version: ${{ steps.read_property.outputs.value}}
version-type: beta
modrinth-id: lJPKRQLl
modrinth-featured: false
modrinth-unfeature-mode: any
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
java: |
11
17
21
loaders: |
paper
purpur
spigot
game-versions: |
>=1.8.8 <=1.21.10
- name: Publish to Modrinth (Beta)
uses: Kir-Antipov/mc-publish@v3.3
if: env.GITEA_ACTIONS == 'true'
with:
files: "*.jar"
version: ${{ steps.read_property.outputs.value}}
version-type: beta
modrinth-id: lJPKRQLl
modrinth-featured: false
modrinth-unfeature-mode: any
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
java: |
11
17
21
loaders: |
paper
purpur
spigot
game-versions: |
>=${{steps.read_property_min_mc_version.outputs.value}} <=${{steps.read_property_max_mc_version.outputs.value}}