Skip to content

Commit

Permalink
Updated Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
louanfontenele committed Dec 29, 2024
1 parent 8d6b380 commit 318e729
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 115 deletions.
34 changes: 17 additions & 17 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
name-template: 'Release ${{ nextReleaseVersion }} 🚀'
tag-template: 'v${{ nextReleaseVersion }}'
name-template: "Release ${{ nextReleaseVersion }} 🚀"
tag-template: "v${{ nextReleaseVersion }}"

categories:
- title: '🚀 Features'
- title: "🚀 Features"
labels:
- 'feature'
- title: '🐛 Bug Fixes'
- "feature"
- title: "🐛 Bug Fixes"
labels:
- 'bug'
- title: '🛠️ Maintenance'
- "bug"
- title: "🛠️ Maintenance"
labels:
- 'chore'
- 'refactor'
- title: '🧩 Dependencies'
- "chore"
- "refactor"
- title: "🧩 Dependencies"
labels:
- 'dependencies'
- "dependencies"

change-template: '- $TITLE by @$AUTHOR in #$NUMBER'
change-template: "- $TITLE by @$AUTHOR in #$NUMBER"

# Capture direct commits (without PR)
no-labels-merge-method: 'title'
no-labels-template: '- $TITLE (commit: [`$SHORT_SHA`](https://github.com/{{github.repository}}/commit/$FULL_SHA))'
no-labels-merge-method: "title"
no-labels-template: "- $TITLE (commit: [`$SHORT_SHA`](https://github.com/{{github.repository}}/commit/$FULL_SHA))"

# Ignore changes in .github
exclude-labels:
- 'ignore-changelog'
- 'skip-release'
- "ignore-changelog"
- "skip-release"
exclude-contributors:
- 'github-actions[bot]'
- "github-actions[bot]"

template: |
## What's Changed
Expand Down
27 changes: 13 additions & 14 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,23 @@ name: .NET

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
154 changes: 77 additions & 77 deletions .github/workflows/release-windows-dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,95 +4,95 @@ on:
push:
branches:
- master
workflow_dispatch: # Allows manual execution
workflow_dispatch: # Allows manual execution

jobs:
release:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all existing tags
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all existing tags

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x
- name: Build Project
run: dotnet build --configuration Release

- name: Build Project
run: dotnet build --configuration Release
- name: Publish Artifacts
run: |
mkdir release
dotnet publish -c Release -o release
- name: Publish Artifacts
run: |
mkdir release
dotnet publish -c Release -o release
- name: Create Zip Archive
run: zip -r release.zip release/

- name: Create Zip Archive
run: zip -r release.zip release/
# Detect changes in the .github directory
- name: Check for .github changes
id: changes
run: |
if git diff --name-only HEAD^ | grep '^\.github/'; then
echo "changes_in_github=true" >> $GITHUB_ENV
else
echo "changes_in_github=false" >> $GITHUB_ENV
fi
# Detect changes in the .github directory
- name: Check for .github changes
id: changes
run: |
if git diff --name-only HEAD^ | grep '^\.github/'; then
echo "changes_in_github=true" >> $GITHUB_ENV
else
echo "changes_in_github=false" >> $GITHUB_ENV
fi
# Apply label if changes are detected in .github
- name: Label PR with ignore-changelog
if: env.changes_in_github == 'true' && github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const pr = context.payload.pull_request;
if (pr) {
github.rest.issues.addLabels({
owner,
repo,
issue_number: pr.number,
labels: ['ignore-changelog']
});
}
# Apply label if changes are detected in .github
- name: Label PR with ignore-changelog
if: env.changes_in_github == 'true' && github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const { owner, repo } = context.repo;
const pr = context.payload.pull_request;
if (pr) {
github.rest.issues.addLabels({
owner,
repo,
issue_number: pr.number,
labels: ['ignore-changelog']
});
}
- 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)
- 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
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 "NEW_TAG=$NEW_TAG"
git tag $NEW_TAG
git push origin $NEW_TAG
echo "tag=$NEW_TAG" >> $GITHUB_ENV
echo "NEW_TAG=$NEW_TAG"
git tag $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: 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: ${{ steps.draft_release.outputs.body }}
artifacts: "release.zip"
draft: false
prerelease: false
- name: Publish Release
uses: ncipollo/release-action@v1
with:
tag: ${{ env.tag }}
name: "Release ${{ env.tag }}"
body: ${{ steps.draft_release.outputs.body }}
artifacts: "release.zip"
draft: false
prerelease: false
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ This project is a console application that modifies Factorio save files to re-en
- 🗂️ Creates a backup of the original save file.
- 📦 Recompresses and restores the save file.
- 🔄 Automated GitHub Releases with changelogs generated from commits and PRs.
- 🏷️ Automatically labels and excludes changes in `.github` from release changelogs.

## 📋 Requirements

Expand Down Expand Up @@ -44,21 +45,27 @@ Alternatively, you can open the `.sln` file in Visual Studio and run the project
This project uses **GitHub Actions** to automate the release process.

### How it Works
- **Triggers**: A new release is automatically created when a tag is pushed (e.g., `v1.0.0`).

- **Triggers**: A new release is automatically created when a tag is pushed (e.g., `v2.0.28-1.0`).
- **Draft Releases**: The changelog is generated dynamically from PRs and commits.
- **Manual Trigger**: Releases can also be triggered manually from the Actions tab.
- **Tag Generation**: Tags are automatically generated with incremental versions based on the game version (e.g., `2.0.28-1.0`, `2.0.28-1.1`).
- **Label Exclusion**: Changes in `.github` are automatically labeled as `ignore-changelog` and excluded from release notes.

### Key Files

### Key Files:
- `.github/workflows/release-windows-dotnet.yml` – Workflow to build and release .NET projects.
- `.github/release-drafter.yml` – Template for changelog generation.

### Create a Tag to Trigger a Release:
### Create a Tag to Trigger a Release

```bash
git tag v1.0.0
git push origin v1.0.0
git tag v2.0.28-1.0
git push origin v2.0.28-1.0
```

### Manual Release:
### Manual Release

Go to **Actions** → Select the workflow → **Run Workflow**.

## 🕹️ How to Use
Expand Down Expand Up @@ -90,6 +97,7 @@ FactorioSaveGameEnableAchievements/

- ⚙️ Ensure the save file is not in use by Factorio while running this tool.
- 🏅 This program only modifies saves that have achievements disabled by running commands or using the map editor.
- 🏷️ Changes made to `.github/` do not appear in the release changelog to reduce noise.

## 📄 License

Expand All @@ -98,4 +106,3 @@ BSD 2-Clause License
## 🤝 Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss the changes you would like to make.

0 comments on commit 318e729

Please sign in to comment.