Skip to content

Update release.yml

Update release.yml #32

Workflow file for this run

name: "Release stable"
on:
push:
branches: [ "main" ]
jobs:
build:
if: "!contains(github.event.head_commit.message, 'ci ignore')"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- name: "Setup PHP 8.0"
uses: shivammathur/[email protected]
with:
php-version: "8.0"
extensions: "yaml"
- name: "Get version"
id: metadata
run: |
echo "VERSION=$(php -r 'echo explode("+", explode("-", yaml_parse_file(getcwd() . "/src/main/resources/plugin.yml")["version"])[0])[0];')" >> $GITHUB_OUTPUT
echo "FULL_VERSION=$(php -r 'echo yaml_parse_file(getcwd() . "/src/main/resources/plugin.yml")["version"];')" >> $GITHUB_OUTPUT
echo "NAME=$(php -r 'echo yaml_parse_file(getcwd() . "/src/main/resources/plugin.yml")["name"];')" >> $GITHUB_OUTPUT
- name: "Set up JDK 17"
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: "maven"
- name: "Build with Maven"
run: mvn -B package --file pom.xml
- name: "Rename JAR"
run: |
cd target/
cp Nukkit-1.0-SNAPSHOT.jar Presence-Man-Nukkit-v${{ steps.metadata.outputs.VERSION }}.jar
cp Nukkit-1.0-SNAPSHOT.jar Presence-Man-Nukkit.jar
cd ../
- name: "Create Release"
uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: false
automatic_release_tag: "v${{ steps.metadata.outputs.VERSION }}"
prerelease: false
title: "Release v${{ steps.metadata.outputs.VERSION }}"
files: "target/Presence-Man-Nukkit-v${{ steps.metadata.outputs.VERSION }}.jar"
- name: "Create version-nukkit.txt"
run: "echo \"${{ steps.metadata.outputs.VERSION }}\" >> version-nukkit.txt"
- name: "Pushes latest version-nukkit.txt file"
uses: dmnemec/copy_file_to_another_repo_action@main
env:
API_TOKEN_GITHUB: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
with:
source_file: 'version-nukkit.txt'
destination_repo: 'Presence-Man/releases'
destination_folder: ''
user_email: '[email protected]'
user_name: 'xxAROX'
commit_message: 'Updated "Nukkit Client" version'
- name: Release to public
uses: softprops/action-gh-release@v1
with:
tag_name: "latest"
name: "Latest releases"
repository: "Presence-Man/releases"
token: ${{ secrets.CUSTOM_GITHUB_TOKEN }}
files: "target/Presence-Man-Nukkit.jar"