Skip to content

Commit

Permalink
feat: setup semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
damienbutt committed Mar 10, 2024
1 parent 4996177 commit 6332008
Show file tree
Hide file tree
Showing 11 changed files with 2,506 additions and 742 deletions.
54 changes: 46 additions & 8 deletions .changelogrc.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,51 @@
{
"header": "Changelog",
"types": [
{ "type": "feat", "section": "🌟 Features" },
{ "type": "fix", "section": "🐛 Bug Fixes" },
{ "type": "chore", "hidden": true },
{ "type": "docs", "section": "📖 Bug Fixes" },
{ "type": "style", "hidden": true },
{ "type": "refactor", "hidden": true },
{ "type": "perf", "section": "🚀 Performance" },
{ "type": "test", "hidden": true }
{
"type": "feat",
"section": "🌟 Features",
"hidden": false
},
{
"type": "fix",
"section": "🐛 Bug Fixes",
"hidden": false
},
{
"type": "chore",
"section": "🧰 Chores",
"hidden": true
},
{
"type": "docs",
"section": "📖 Documentation",
"hidden": false
},
{
"type": "style",
"section": "💅 Style",
"hidden": false
},
{
"type": "refactor",
"section": "✨ Refactor",
"hidden": false
},
{
"type": "perf",
"section": "🚀 Performance",
"hidden": false
},
{
"type": "test",
"section": "🧪 Tests",
"hidden": false
},
{
"type": "build",
"section": "🛠️ Build",
"hidden": false
},
{ "type": "ci", "section": "🤖 CI", "hidden": false }
]
}
117 changes: 56 additions & 61 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ defaults:
shell: pwsh

jobs:
setup:
name: Setup
build-and-release:
name: Build & Release

runs-on: [self-hosted, windows, server]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Show Environment
run: |
Expand Down Expand Up @@ -78,73 +79,67 @@ jobs:
Write-Host "RUNNER_TEMP: $env:RUNNER_TEMP"
Write-Host "RUNNER_TOOL_CACHE: $env:RUNNER_TOOL_CACHE"
- name: Setup Node.js
uses: actions/setup-node@v3
- uses: pnpm/action-setup@v3
with:
node-version-file: ".nvmrc"
version: 8

- name: Install (with cache)
uses: bahmutov/npm-install@v1
- name: Setup Node.js
uses: actions/setup-node@v4
with:
install-command: pnpm install

- name: Check for genlinx
run: which genlinx

build:
name: Build

runs-on: [self-hosted, windows, server]
node-version-file: ".nvmrc"
cache: pnpm

needs: [setup]
- name: Install
run: pnpm install

steps:
- name: Run Genlinx
- name: Build
run: ./build.ps1

- name: Upload build log only if failure
uses: actions/upload-artifact@v3
if: failure()
with:
name: build-log
path: ./*.build.log

- name: Upload artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
./Source/*.tko
./*.build.log
release:
name: Create Release

runs-on: [self-hosted, windows, server]

needs: [build]

if: github.ref == 'refs/heads/master'
- name: Release
id: release
if: github.ref == 'refs/heads/master'

steps:
- name: Conventional Changelog
id: changelog
uses: TriPSs/conventional-changelog-action@d360fad3a42feca6462f72c97c165d60a02d4bf2
# v4 doesn't seem to be working, so using a specific commit for now
uses: cycjimmy/semantic-release-action@6d88447fcd3237e1d617f4f663e5ad79a6bf45b1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
tag-prefix: ""
release-count: "0"
create-summary: true
preset: "conventionalcommits"
config-file-path: "./.changelogrc.json"

- name: Create Github Release
uses: actions/create-release@v1
if: ${{ steps.changelog.outputs.skipped == 'false' }}
extra_plugins: |
@semantic-release/changelog
@semantic-release/exec
@semantic-release/git
conventional-changelog-conventionalcommits
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Show Release Output Values
if: github.ref == 'refs/heads/master'
run: |
Write-Host "New Release Published: ${{ steps.release.outputs.new_release_published }}"
Write-Host "New Release Version: ${{ steps.release.outputs.new_release_version }}"
Write-Host "New Release Major Version: ${{ steps.release.outputs.new_release_major_version }}"
Write-Host "New Release Minor Version: ${{ steps.release.outputs.new_release_minor_version }}"
Write-Host "New Release Patch Version: ${{ steps.release.outputs.new_release_patch_version }}"
Write-Host "New Release Channel: ${{ steps.release.outputs.new_release_channel }}"
Write-Host "New Release Notes: ${{ steps.release.outputs.new_release_notes }}"
Write-Host "New Release Git Head: ${{ steps.release.outputs.new_release_git_head }}"
Write-Host "New Release Git Tag: ${{ steps.release.outputs.new_release_git_tag }}"
Write-Host "Last Release Version: ${{ steps.release.outputs.last_release_version }}"
Write-Host "Last Release Git Head: ${{ steps.release.outputs.last_release_git_head }}"
Write-Host "Last Release Git Tag: ${{ steps.release.outputs.last_release_git_tag }}"
- name: Dispatch Scoop Excavator
if: ${{ github.ref == 'refs/heads/master' && steps.release.outputs.new_release_published == 'true' }}
uses: peter-evans/repository-dispatch@v3
with:
tag_name: ${{ steps.changelog.outputs.tag }}
release_name: ${{ steps.changelog.outputs.tag }}
body: ${{ steps.changelog.outputs.clean_changelog }}
# body_path: CHANGELOG.md
token: ${{ secrets.SCOOP_NORGATEAV_AMX }}
repository: norgate-av/scoop-norgateav-amx
event-type: excavate
client-payload: |-
{
"repo": {
"name": "${{ github.repository }}",
"owner": "${{ github.repository_owner }}",
"ref": "${{ github.ref }}",
"sha": "${{ steps.release.outputs.new_release_git_head }}",
"tag": "${{ steps.release.outputs.new_release_git_tag }}"
}
}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
enable-pre-post-scripts=true
124 changes: 124 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"branches": ["master"],
"preset": "conventionalcommits",
"plugins": [
[
"@semantic-release/commit-analyzer",
{
"releaseRules": [{ "type": "refactor", "release": "patch" }],
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
}
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"parserOpts": {
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES", "BREAKING"]
},
"writerOpts": {
"commitsSort": ["subject", "scope"]
},
"presetConfig": {
"header": "Changelog",
"types": [
{
"type": "feat",
"section": "🌟 Features",
"hidden": false
},
{
"type": "fix",
"section": "🐛 Bug Fixes",
"hidden": false
},
{
"type": "chore",
"section": "🧰 Chores",
"hidden": true
},
{
"type": "docs",
"section": "📖 Documentation",
"hidden": false
},
{
"type": "style",
"section": "💅 Style",
"hidden": false
},
{
"type": "refactor",
"section": "✨ Refactor",
"hidden": false
},
{
"type": "perf",
"section": "🚀 Performance",
"hidden": false
},
{
"type": "test",
"section": "🧪 Tests",
"hidden": false
},
{
"type": "build",
"section": "🛠️ Build",
"hidden": false
},
{ "type": "ci", "section": "🤖 CI", "hidden": false }
]
}
}
],
[
"@semantic-release/changelog",
{
"changelogTitle": "# Changelog"
}
],
[
"@semantic-release/npm",
{
"npmPublish": false
}
],
[
"@semantic-release/exec",
{
"shell": "pwsh",
"prepareCmd": "(Get-Content -Path manifest.json) -replace '\"version\": \".*\"', '\"version\": \"${nextRelease.version}\"' | Set-Content manifest.json"
}
],
[
"@semantic-release/exec",
{
"shell": "pwsh",
"prepareCmd": "./archive.ps1"
}
],
[
"@semantic-release/git",
{
"assets": ["package.json", "CHANGELOG.md", "manifest.json"],
"message": "chore(release): ${nextRelease.version} [skip ci]"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "./dist/*.{zip,sha256}"
},
{
"path": "./src/*.{tko,TKO}"
}
]
}
]
]
}
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
}
},
"editor.codeActionsOnSave": {
"source.fixAll.markdownlint": true
}
"source.fixAll.markdownlint": "explicit"
},
"github-actions.workflows.pinned.workflows": [".github/workflows/main.yml"]
}
Loading

0 comments on commit 6332008

Please sign in to comment.