Illyrion CI/CD #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Illyrion CI/CD | |
run-name: "Illyrion CI/CD" | |
on: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
release: | |
name: Release | |
if: github.event_name == 'workflow_dispatch' || contains(github.event.head_commit.message, '.deploy') | |
runs-on: [ubuntu-latest] | |
environment: | |
name: ${{ github.ref_name }} | |
url: ${{ steps.create_release.outputs.url }} | |
outputs: | |
VERSION: ${{ steps.get_version.outputs.VERSION }} | |
SHA1: ${{ steps.calculate_sha1.outputs.SHA1 }} | |
steps: | |
- id: checkout | |
name: Checkout | |
uses: actions/checkout@main | |
- id: get_version | |
name: Get Version | |
run: echo "VERSION=$(jq -r '.version' version.json)" >> $GITHUB_OUTPUT | |
- id: create_zip | |
name: Create Zip File | |
run: | | |
mkdir -p temp | |
cd illyriarp | |
zip -r "../temp/IllyriaRP_${{ steps.get_version.outputs.VERSION }}.zip" assets pack.mcmeta pack.png | |
- id: calculate_sha1 | |
name: Calculate SHA1 | |
run: echo "SHA1=$(sha1sum "temp/IllyriaRP_${{ steps.get_version.outputs.VERSION }}.zip" | awk '{ print $1 }')" >> $GITHUB_OUTPUT | |
- id: create_release | |
name: Create Release | |
uses: softprops/action-gh-release@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
draft: ${{ contains(github.event.head_commit.message, '.draft') }} | |
files: temp/IllyriaRP_${{ steps.get_version.outputs.VERSION }}.zip | |
body: | | |
Direct Download Link: https://github.com/${{ github.repository }}/releases/download/${{ steps.get_version.outputs.VERSION }}/IllyriaRP_${{ steps.get_version.outputs.VERSION }}.zip | |
SHA-1 Hash: ${{ steps.calculate_sha1.outputs.SHA1 }} | |
generate_release_notes: true | |
prerelease: ${{ contains(github.event.head_commit.message, '.pre') }} | |
tag_name: ${{ steps.get_version.outputs.VERSION }} | |
# - id: sync_files | |
# name: Sync files | |
# uses: SamKirkland/FTP-Deploy-Action@master | |
# with: | |
# server: ${{ secrets.FTP_SERVER }} | |
# username: ${{ secrets.FTP_USERNAME }} | |
# password: ${{ secrets.FTP_PASSWORD }} | |
# local-dir: ./temp/ | |
# server-dir: /plugins/oraxen/pack/external_packs/ |