Skip to content

Feature: Added changelogs #28

Feature: Added changelogs

Feature: Added changelogs #28

name: .NET Windows Release 🚀
on:
push:
branches:
- master
workflow_dispatch: # Allows manual execution
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensures all tags are fetched
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build Project
run: dotnet build --configuration Release
- name: Publish Artifacts
run: |
mkdir -p release
dotnet publish ./FactorioSaveGameEnableAchievements/FactorioSaveGameEnableAchievements.csproj -c Release -o release
- name: Create Zip Archive
run: zip -r release.zip release/
# Grant execute permission to the changelog script
- name: Give Execution Permission to Script
run: chmod +x .github/scripts/generate-changelog.sh
# Run the script to generate changelog
- name: Generate Changelog
run: |
.github/scripts/generate-changelog.sh
- name: Generate Version Tag
id: tag
run: |
GAME_VERSION="2.0.28"
LATEST_TAG=$(git tag --sort=-v:refname | grep "^${GAME_VERSION}-" | head -n 1)
if [ -z "$LATEST_TAG" ]; then
NEW_TAG="${GAME_VERSION}-1.0"
else
LAST_VERSION=$(echo $LATEST_TAG | awk -F '-' '{print $2}')
NEW_VERSION=$(echo "$LAST_VERSION + 0.1" | bc)
NEW_TAG="${GAME_VERSION}-$(printf %.1f $NEW_VERSION)"
fi
echo "Creating and signing tag: $NEW_TAG"
git tag $NEW_TAG -m "Release $NEW_TAG"
git push origin $NEW_TAG
echo "tag=$NEW_TAG" >> $GITHUB_ENV
- name: Draft Release
id: draft_release
uses: release-drafter/release-drafter@v5
with:
config-name: release-drafter.yml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.tag }}
name: "Release ${{ env.tag }}"
body_path: ./changelog.md # Uses the generated changelog
artifacts: "release.zip"
draft: false
prerelease: false