From ca094dd0f60bcdaa1c551e9e234bab8dc4b7a372 Mon Sep 17 00:00:00 2001 From: Xevion Date: Mon, 18 Nov 2024 19:48:11 -0600 Subject: [PATCH] feat: Automatic release scripts --- .gitattributes | 15 +++++++ .github/workflows/release.yaml | 33 +++++++++++++++ .gitignore | 6 +++ .releaserc | 73 ++++++++++++++++++++++++++++++++++ 4 files changed, 127 insertions(+) create mode 100644 .gitattributes create mode 100644 .github/workflows/release.yaml create mode 100644 .gitignore create mode 100644 .releaserc diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..dd67689 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,15 @@ +# Set the default behavior to automatically detect text files and perform LF normalization +* text=auto + +# files that should not be modified +*.png binary +*.blend binary export-ignore + +# files that should not get included in a release zip +README.md export-ignore +.vscode export-ignore +.git export-ignore +.github export-ignore +.gitignore export-ignore +.gitattributes export-ignore +.releaserc export-ignore \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..055d169 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,33 @@ +name: Release + +permissions: write-all + +on: + push: + branches: + - main # Change to the correct one upon release, master + +jobs: + release: + name: release + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: Install release dependencies + run: | + npm install semantic-release@^24 \ + @semantic-release/git@^10 semantic-release-factorio@^1.5.1 \ + conventional-changelog-conventionalcommits@^8 + + - name: Run semantic-release + run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + FACTORIO_TOKEN: ${{ secrets.FACTORIO_TOKEN }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2babd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +.vscode/* +!.vscode/extensions.json +!.vscode/settings.json + +*.code-workspace +*.zip diff --git a/.releaserc b/.releaserc new file mode 100644 index 0000000..aac8a09 --- /dev/null +++ b/.releaserc @@ -0,0 +1,73 @@ +{ + "branches": ["main"], + "plugins": + [ + [ + "@semantic-release/commit-analyzer", + { + "preset": "conventionalcommits", + "releaseRules": + [ + { "breaking": true, "release": "major" }, + { "type": "info", "release": "patch" }, + { "type": "feat", "release": "minor" }, + { "type": "feature", "release": "minor" }, + { "type": "gui", "release": "patch" }, + { "type": "balance", "release": "patch" }, + { "type": "perf", "release": "patch" }, + { "type": "performance", "release": "patch" }, + { "type": "compat", "release": "patch" }, + { "type": "compatibility", "release": "patch" }, + { "type": "fix", "release": "patch" }, + { "type": "graphics", "release": "patch" }, + { "type": "sound", "release": "patch" }, + { "type": "locale", "release": "patch" }, + { "type": "translate", "release": "patch" }, + { "type": "control", "release": "patch" }, + { "type": "other", "release": "patch" }, + ], + }, + ], + [ + "@semantic-release/release-notes-generator", + { + "preset": "conventionalcommits", + "writerOpts": + { + "headerPartial": "---------------------------------------------------------------------------------------------------\nVersion: {{version}}\nDate: {{#if date}}{{date}}{{else}}????{{/if}}\n", + "footerPartial": "", + "commitPartial": "{{#if scope}}[{{scope}}] {{/if}}{{~subject}}", + "mainTemplate": "{{> header}}\n{{#each commitGroups}}\n {{title}}:\n{{#each commits}}\n - {{> commit root=@root}}\n{{/each}}\n{{/each}}", + }, + "presetConfig": + { + "types": + [ + { "type": "info", "section": "Info" }, + { "type": "feat", "section": "Features" }, + { "type": "feature", "section": "Features" }, + { "type": "gui", "section": "Gui" }, + { "type": "balance", "section": "Balancing" }, + { "type": "perf", "section": "Optimizations" }, + { "type": "performance", "section": "Optimizations" }, + { "type": "compat", "section": "Compatibility" }, + { "type": "compatibility", "section": "Compatibility" }, + { "type": "fix", "section": "Bugfixes" }, + { "type": "graphics", "section": "Graphics" }, + { "type": "sound", "section": "Sounds" }, + { "type": "locale", "section": "Locale" }, + { "type": "translate", "section": "Translation" }, + { "type": "control", "section": "Control" }, + { "type": "other", "section": "Changes" }, + ], + }, + }, + ], + "semantic-release-factorio", + [ + "@semantic-release/github", + { "assets": [{ "path": "*_*.*.*.zip", "label": "Packaged Mod" }] }, + ], + ["@semantic-release/git", { "assets": ["changelog.txt", "info.json"] }], + ], +}