Skip to content

Merge pull request #150 from HoI4-LOTRMod-Team/dev #10

Merge pull request #150 from HoI4-LOTRMod-Team/dev

Merge pull request #150 from HoI4-LOTRMod-Team/dev #10

on:
push:
branches:
- master
name: Create Release
jobs:
build:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get current date and time in CEST, and compatible version from descriptor.mod
id: get-version
run: |
# Read compatible version from descriptor.mod and remove quotes
compatible_version=$(grep -oP 'supported_version="\K[0-9]+\.[0-9]+\.\*' descriptor.mod | sed 's/"//g')
# Get current date and time in CEST
date_time=$(TZ="Europe/Paris" date +'%d-%m-%Y_%H-%M')
echo "compatible_version=$compatible_version" >> $GITHUB_OUTPUT
echo "date_time=$date_time" >> $GITHUB_OUTPUT
- name: Read patch notes
id: patch-notes
run: |
# Read the contents of patch_notes.txt
patch_notes=$(cat patch_notes.txt)
# Escape newline characters to be compatible with GitHub Actions output
patch_notes="${patch_notes//'%'/'%25'}"
patch_notes="${patch_notes//$'\n'/'%0A'}"
patch_notes="${patch_notes//$'\r'/'%0D'}"
echo "patch_notes=$patch_notes" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: ncipollo/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.LOTR_MOD_RELEASE_TOKEN }}
with:
tag: ${{ steps.get-version.outputs.date_time }}
name: ${{ steps.get-version.outputs.date_time }}
body: |
Compatible HoI4 Version: v${{ steps.get-version.outputs.compatible_version }}
${{ steps.patch-notes.outputs.patch_notes }}
draft: false
prerelease: false