generated from atampy25/smf-mod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 266458e
Showing
9 changed files
with
1,037 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
module.exports = { | ||
types: [ | ||
{ types: ["feat", "feature"], label: "New Features" }, | ||
{ types: ["fix", "bugfix"], label: "Bug Fixes" }, | ||
{ types: ["improvements", "enhancement"], label: "Improvements" }, | ||
{ types: ["perf"], label: "Performance Improvements" }, | ||
{ types: ["build", "ci"], label: "Build System" }, | ||
{ types: ["refactor"], label: "Refactors" }, | ||
{ types: ["doc", "docs"], label: "Documentation Changes" }, | ||
{ types: ["test", "tests"], label: "Tests" }, | ||
{ types: ["style"], label: "Code Style Changes" }, | ||
{ types: ["chore"], label: "Chores" }, | ||
{ types: ["other"], label: "Other Changes" } | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
name: Release | ||
|
||
permissions: | ||
contents: write | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
if: "!startsWith(github.ref, 'refs/tags/')" | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
ref: "main" | ||
fetch-depth: 0 | ||
|
||
- name: Create package.json | ||
run: | | ||
echo "{\"name\": \"smf-mod\",\"version\":\"0.0.0\",\"description\":\"An SMF mod.\",\"private\":true}" > package.json | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
||
- name: Install semantic release plugin | ||
run: | | ||
npm install --save-dev semantic-release-export-data conventional-changelog-conventionalcommits | ||
- name: Create .releaserc | ||
env: | ||
REPO_URL: ${{ format('https://github.com/{0}.git', github.repository) }} | ||
run: | | ||
echo "{\"branches\":[\"main\"],\"plugins\":[[\"@semantic-release/commit-analyzer\",{\"preset\":\"conventionalcommits\",\"releaseRules\":[{\"type\":\"enhancement\",\"release\":\"minor\"}]}], \"semantic-release-export-data\"],\"repositoryUrl\":\"$REPO_URL\",\"tagFormat\":\"\${version}\"}" > .releaserc | ||
- name: Get first commit | ||
id: firstCommit | ||
run: echo "FIRST_COMMIT=$(git rev-list --date-order main | tail -1)" >> $GITHUB_OUTPUT | ||
|
||
- uses: mukunku/tag-exists-action@v1.2.0 | ||
id: checkTag | ||
with: | ||
tag: "0.1.0" | ||
|
||
- name: Create tag | ||
if: ${{ steps.checkTag.outputs.exists == 'false' }} | ||
uses: tvdias/github-tagger@v0.0.2 | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: "0.1.0" | ||
commit-sha: ${{ steps.firstCommit.outputs.FIRST_COMMIT }} | ||
|
||
- name: Get new version | ||
id: newVersion | ||
run: npx --yes semantic-release --branches main --dry-run | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Update manifest.json version | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
uses: jossef/action-set-json-field@v2 | ||
with: | ||
file: "manifest.json" | ||
field: "version" | ||
value: ${{ steps.newVersion.outputs.new-release-version }} | ||
|
||
- name: Update manifest.json updateCheck | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
uses: jossef/action-set-json-field@v2 | ||
with: | ||
file: "manifest.json" | ||
field: "updateCheck" | ||
value: ${{ format('https://github.com/{0}/releases/latest/download/updates.json', github.repository) }} | ||
|
||
- name: Format | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
uses: actionsx/prettier@v2 | ||
with: | ||
args: --write . | ||
|
||
- name: Commit changes | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
uses: EndBug/add-and-commit@v9.1.0 | ||
with: | ||
default_author: github_actions | ||
message: "chore: mod update" | ||
tag: ${{ steps.newVersion.outputs.new-release-version }} | ||
|
||
- name: Generate changelog | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
id: changelog | ||
uses: loopwerk/tag-changelog@v1.0.4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
config_file: .github/tag-changelog-config.js | ||
exclude_types: other,docs,chore,build,amend,refactor | ||
|
||
- name: Get mod ID | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
id: modID | ||
uses: notiz-dev/github-action-json-property@release | ||
with: | ||
path: "manifest.json" | ||
prop_path: "id" | ||
|
||
- name: Copy files | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
env: | ||
TARGETDIR: ${{ steps.modID.outputs.prop }} | ||
run: | | ||
mkdir $TARGETDIR | ||
for file in *;do test "$file" != "$TARGETDIR" && cp -r "$file" "$TARGETDIR/";done | ||
rm -rf "$TARGETDIR/node_modules" | ||
rm "$TARGETDIR/package.json" "$TARGETDIR/package-lock.json" "$TARGETDIR/README.md" | ||
- name: Create ZIP | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
uses: TheDoctor0/zip-release@4fb9e4ff72847dd3d1c111cf63834e353ed7cb3d | ||
with: | ||
filename: mod.framework.zip | ||
path: ${{ steps.modID.outputs.prop }} | ||
|
||
- name: Create updates.json | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
env: | ||
VERSION: ${{ toJSON(steps.newVersion.outputs.new-release-version) }} | ||
CHANGELOG: ${{ toJSON(steps.changelog.outputs.changes) }} | ||
URL: ${{ format('https://github.com/{0}/releases/latest/download/mod.framework.zip', github.repository) }} | ||
run: | | ||
echo "{\"version\":$VERSION,\"changelog\":$CHANGELOG,\"url\":\"$URL\"}" > updates.json | ||
- name: Release | ||
if: ${{ steps.newVersion.outputs.new-release-version }} | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: ${{ steps.newVersion.outputs.new-release-version }} | ||
body: ${{ steps.changelog.outputs.changes }} | ||
tag_name: ${{ steps.newVersion.outputs.new-release-version }} | ||
repository: ${{ github.repository }} | ||
files: | | ||
mod.framework.zip | ||
updates.json |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package.json | ||
package-lock.json | ||
.releaserc | ||
node_modules |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"trailingComma": "none", | ||
"requirePragma": false, | ||
"bracketSpacing": true, | ||
"singleQuote": false, | ||
"printWidth": 125, | ||
"useTabs": true, | ||
"tabWidth": 4, | ||
"semi": false | ||
} |
Oops, something went wrong.