Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add release workflow #1185

Merged
merged 103 commits into from
Dec 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
103 commits
Select commit Hold shift + click to select a range
a7364d1
chore: WIP
meteyou Nov 28, 2022
051072c
chore: WIP
meteyou Nov 28, 2022
ff4c547
chore: WIP
meteyou Nov 28, 2022
570a02b
chore: WIP
meteyou Nov 28, 2022
1aea60b
chore: WIP
meteyou Dec 2, 2022
e42f33f
chore: WIP
meteyou Dec 2, 2022
a60d215
chore: WIP
meteyou Dec 3, 2022
b1bd6bf
chore: WIP
meteyou Dec 3, 2022
c9cf5fb
chore: WIP
meteyou Dec 3, 2022
9a72ac1
chore: WIP
meteyou Dec 3, 2022
eb56c56
chore: WIP
meteyou Dec 3, 2022
2857194
chore: WIP
meteyou Dec 4, 2022
f02d7ea
chore: WIP
meteyou Dec 4, 2022
3e53528
chore: WIP
meteyou Dec 4, 2022
0bdb606
chore: WIP
meteyou Dec 4, 2022
967bced
chore: WIP
meteyou Dec 4, 2022
709995b
chore: WIP
meteyou Dec 4, 2022
9773bd1
chore: WIP
meteyou Dec 4, 2022
8485b2d
chore: WIP
meteyou Dec 4, 2022
b876131
chore: WIP
meteyou Dec 4, 2022
ccc922c
chore: WIP
meteyou Dec 4, 2022
5490f8b
chore: WIP
meteyou Dec 4, 2022
47536ad
chore: WIP
meteyou Dec 4, 2022
f75ae09
chore: WIP
meteyou Dec 4, 2022
de1952d
chore: WIP
meteyou Dec 4, 2022
c90efb9
chore: WIP
meteyou Dec 4, 2022
ff75f70
chore: WIP
meteyou Dec 4, 2022
f6aeb38
chore: WIP
meteyou Dec 4, 2022
80d6993
chore: WIP
meteyou Dec 4, 2022
4d335dc
chore: WIP
meteyou Dec 4, 2022
94cf4fe
chore: WIP
meteyou Dec 4, 2022
bd9ce5a
chore: WIP
meteyou Dec 4, 2022
db3e34c
fix: testfix 1
meteyou Dec 4, 2022
a6579ef
chore: WIP
meteyou Dec 4, 2022
d0b14fa
chore: WIP
meteyou Dec 4, 2022
9760d0c
fix: testfix 1
meteyou Dec 4, 2022
0ad5c88
chore: WIP
meteyou Dec 4, 2022
1954fd8
chore: WIP
meteyou Dec 4, 2022
8f90117
chore: WIP
meteyou Dec 4, 2022
f702020
chore: WIP
meteyou Dec 4, 2022
11a9bd1
chore: WIP
meteyou Dec 4, 2022
12a666d
chore: WIP
meteyou Dec 4, 2022
121cad9
chore: WIP
meteyou Dec 4, 2022
aa427d2
chore: WIP
meteyou Dec 4, 2022
b7bbfc8
chore: WIP
meteyou Dec 4, 2022
1c78f89
chore: WIP
meteyou Dec 4, 2022
ad0d541
chore: WIP
meteyou Dec 8, 2022
2b84de1
chore: WIP
meteyou Nov 28, 2022
e7cc58c
chore: WIP
meteyou Nov 28, 2022
3ee6aa9
chore: WIP
meteyou Nov 28, 2022
af2861e
chore: WIP
meteyou Nov 28, 2022
357c047
chore: WIP
meteyou Dec 2, 2022
bf0e29e
chore: WIP
meteyou Dec 2, 2022
f6aa1bc
chore: WIP
meteyou Dec 3, 2022
2553006
chore: WIP
meteyou Dec 3, 2022
718209e
chore: WIP
meteyou Dec 3, 2022
e2cc690
chore: WIP
meteyou Dec 3, 2022
1b574dd
chore: WIP
meteyou Dec 3, 2022
fb034b7
chore: WIP
meteyou Dec 4, 2022
2a7fb81
chore: WIP
meteyou Dec 4, 2022
dc1ff81
chore: WIP
meteyou Dec 4, 2022
e748d6b
chore: WIP
meteyou Dec 4, 2022
0b1ede7
chore: WIP
meteyou Dec 4, 2022
7d4ace1
chore: WIP
meteyou Dec 4, 2022
517c510
chore: WIP
meteyou Dec 4, 2022
c760bfa
chore: WIP
meteyou Dec 4, 2022
c74097a
chore: WIP
meteyou Dec 4, 2022
700056c
chore: WIP
meteyou Dec 4, 2022
b2793ff
chore: WIP
meteyou Dec 4, 2022
0bf94c6
chore: WIP
meteyou Dec 4, 2022
d1b9ffb
chore: WIP
meteyou Dec 4, 2022
d78b191
chore: WIP
meteyou Dec 4, 2022
2b826ae
chore: WIP
meteyou Dec 4, 2022
afcb23d
chore: WIP
meteyou Dec 4, 2022
a77079d
chore: WIP
meteyou Dec 4, 2022
fb16a92
chore: WIP
meteyou Dec 4, 2022
41e2e19
chore: WIP
meteyou Dec 4, 2022
c467d0a
chore: WIP
meteyou Dec 4, 2022
9d84717
chore: WIP
meteyou Dec 4, 2022
22fb82b
fix: testfix 1
meteyou Dec 4, 2022
d08b86a
chore: WIP
meteyou Dec 4, 2022
f59e53c
chore: WIP
meteyou Dec 4, 2022
e8146f6
fix: testfix 1
meteyou Dec 4, 2022
18a855f
chore: WIP
meteyou Dec 4, 2022
49a6f7a
chore: WIP
meteyou Dec 4, 2022
17ea8b8
chore: WIP
meteyou Dec 4, 2022
a0f411a
chore: WIP
meteyou Dec 4, 2022
e60d202
chore: WIP
meteyou Dec 4, 2022
cc70572
chore: WIP
meteyou Dec 4, 2022
0297804
chore: WIP
meteyou Dec 4, 2022
e91ecc1
chore: WIP
meteyou Dec 4, 2022
b4a6bce
chore: WIP
meteyou Dec 4, 2022
138fb12
chore: WIP
meteyou Dec 4, 2022
6d1cc71
chore: WIP
meteyou Dec 8, 2022
0e36d15
Merge remote-tracking branch 'origin/chore/release-workflow' into cho…
meteyou Dec 8, 2022
d8677b7
chore: remove unused config file
meteyou Dec 8, 2022
e6b45df
chore: add sorting numbers to scope groups
meteyou Dec 8, 2022
5a83ccc
chore: add token to push commit to develop
meteyou Dec 8, 2022
50c1118
chore: merge update-changelog workflow in release workflow
meteyou Dec 8, 2022
81aaa28
Merge branch 'develop' into chore/release-workflow
meteyou Dec 9, 2022
b7374dd
chore: add remote upload
meteyou Dec 10, 2022
258a512
chore: remove debug mode
meteyou Dec 10, 2022
c6708ae
chore: fix local-dir path
meteyou Dec 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
name: Release

on:
workflow_dispatch:
inputs:
version:
type: string
description: New version number in X.Y.Z
required: true

jobs:
push-version-number:
runs-on: ubuntu-latest
steps:
- name: Clone develop repository
uses: actions/checkout@v3
with:
token: ${{ secrets.PAT }}
ref: 'develop'

- name: Push version number
shell: bash
run: |
npm version --no-git-tag-version ${{ github.event.inputs.version }}

- name: git add & commit & push
uses: EndBug/add-and-commit@v9
with:
add: 'package.json package-lock.json'
default_author: github_actions
message: 'chore: push version number to v${{ github.event.inputs.version }}'
tag: 'v${{ github.event.inputs.version }}'
push: true

update-master-branch:
needs: ['push-version-number']
runs-on: ubuntu-latest
steps:
- uses: everlytic/branch-merge@1.1.5
with:
github_token: ${{ github.token }}
source_ref: 'develop'
target_branch: 'master'
commit_message_template: '[Automated] Merged {source_ref} into target {target_branch}'

release:
needs: ['update-master-branch']
runs-on: ubuntu-latest
steps:
- name: Fetch repo
uses: actions/checkout@v3
with:
ref: 'master'
fetch-depth: 0

- name: Install node
uses: actions/setup-node@v3
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Build
run: npm run build

- name: Move build out of dist
shell: bash
run: mv ./dist/mainsail.zip ./mainsail.zip

- name: Generate a changelog
uses: orhun/git-cliff-action@v1
id: generate-changelog
with:
config: ./cliff-release.toml
args: -vv --latest --strip header
env:
output: CHANGES.md

- name: Create release and upload build
uses: softprops/action-gh-release@v1
id: create-release
with:
name: v${{ github.event.inputs.version }}
tag_name: v${{ github.event.inputs.version }}
token: ${{ secrets.GITHUB_TOKEN }}
files: ./mainsail.zip
body: ${{ steps.generate-changelog.outputs.content }}

- name: Copy remote configs to dist
shell: bash
run: cp ./remote/* ./dist/

- name: Upload to remote server
uses: SamKirkland/FTP-Deploy-Action@4.3.3
with:
server: ${{ secrets.REMOTEHOST }}
username: ${{ secrets.REMOTEUSER }}
password: ${{ secrets.REMOTEPASSWORD }}
dangerous-clean-slate: true
local-dir: ./dist/

update-changelog:
needs: ['release']
name: Generate changelog
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: 'develop'
token: ${{ secrets.PAT }}
fetch-depth: 0

- name: Get latest tag
id: latest_tag
shell: bash
run: |
echo "TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
- name: Generate a changelog
uses: orhun/git-cliff-action@v1
id: git-cliff
with:
config: cliff.toml
args: v0.0.4..${{ steps.latest_tag.outputs.TAG_NAME }}
env:
OUTPUT: ${{ github.workspace }}/CHANGELOG.md

- name: Show CHANGELOG
run: |
cat CHANGELOG.md
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: 'chore(changelog): update changelog'
file_pattern: CHANGELOG.md
42 changes: 0 additions & 42 deletions .github/workflows/update_changelog.yml

This file was deleted.

66 changes: 66 additions & 0 deletions cliff-release.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# configuration file for git-cliff (0.1.0)

[changelog]
# changelog header
header = """
# What's Changed
"""
# template for the changelog body
# https://tera.netlify.app/docs/#introduction
body = """
{% for group, commits in commits | group_by(attribute="group") %}\
### {{ group | split(pat="$") | last | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
- **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}

{%- endfor -%}
{%- for commit in commits %}
{%- if commit.scope -%}
{% else -%}
{% raw %}\n{% endraw %}\
- {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}

{% endif -%}
{% endfor -%}
{% raw %}\n{% endraw %}
{% endfor %}\n\
"""
# remove the leading and trailing whitespaces from the template
trim = true
# changelog footer
footer = """
"""

[git]
# allow only conventional commits
# https://www.conventionalcommits.org
conventional_commits = true
filter_unconventional = true
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^feat(\\(.*\\))?:", group = "1$Features"},
{ message = "^feature(\\(.*\\))?:", group = "1$Features"},
{ message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},
{ message = "^docs(\\(.*\\))?:", group = "7$Documentation"},
{ message = "^perf(\\(.*\\))?:", group = "3$Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "4$Refactor"},
{ message = "^style(\\(.*\\))?:", group = "5$Styling"},
{ message = "^test(\\(.*\\))?:", group = "9$Other"},
{ message = "^locale(\\(.*\\))?:", group = "6$Localization"},
{ message = "^chore(\\(.*\\))?:", group = "9$Other"},
{ body = ".*security", group = "Security"},
]
# filter out the commits that are not matched by commit parsers
filter_commits = true
ignore_tags="v*-(beta|rc)*"
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
26 changes: 12 additions & 14 deletions cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@ body = """
## [unreleased]
{% endif %}\
{% for group, commits in commits | group_by(attribute="group") %}\
### {{ group | upper_first }}
### {{ group | split(pat="$") | last | upper_first }}
{% for commit in commits
| filter(attribute="scope")
| sort(attribute="scope") %}
- **{{commit.scope}}**: {{ commit.message | upper_first | trim }} | [{{ commit.id | truncate(length=7, end="") }}]({{ commit.id }})\
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}

{%- endfor -%}
{%- for commit in commits %}
{%- if commit.scope -%}
Expand All @@ -35,7 +34,6 @@ body = """
{%- if commit.breaking %}
{% raw %} {% endraw %}- **BREAKING**: {{commit.breaking_description}}
{%- endif -%}

{% endif -%}
{% endfor -%}
{% raw %}\n{% endraw %}
Expand All @@ -55,21 +53,21 @@ filter_unconventional = false
# regex for parsing and grouping commits
commit_parsers = [
{ message = "^docs\\(changelog\\):", group = "Changelog", skip = true}, # Old redundant commits
{ message = "^feat(\\(.*\\))?:", group = "Features"},
{ message = "^feature(\\(.*\\))?:", group = "Features"},
{ message = "^fix(\\(.*\\))?:", group = "Bug Fixes"},
{ message = "^docs(\\(.*\\))?:", group = "Documentation"},
{ message = "^perf(\\(.*\\))?:", group = "Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "Refactor"},
{ message = "^style(\\(.*\\))?:", group = "Styling"},
{ message = "^test(\\(.*\\))?:", group = "Testing"},
{ message = "^locale(\\(.*\\))?:", group = "Localization"},
{ message = "^chore(\\(.*\\))?:", group = "Miscellaneous Tasks", skip = true}, # chore tasks are not relevant for the changelog
{ message = "^feat(\\(.*\\))?:", group = "1$Features"},
{ message = "^feature(\\(.*\\))?:", group = "1$Features"},
{ message = "^fix(\\(.*\\))?:", group = "2$Bug Fixes and Improvements"},
{ message = "^docs(\\(.*\\))?:", group = "7$Documentation"},
{ message = "^perf(\\(.*\\))?:", group = "3$Performance"},
{ message = "^refactor(\\(.*\\))?:", group = "4$Refactor"},
{ message = "^style(\\(.*\\))?:", group = "5$Styling"},
{ message = "^test(\\(.*\\))?:", group = "9$Other"},
{ message = "^locale(\\(.*\\))?:", group = "6$Localization"},
{ message = "^chore(\\(.*\\))?:", group = "9$Other"},
{ body = ".*security", group = "Security"},
{ message = "release v2.1.2", group = "Release"}, # workaround for v2.1.2 release
]
# filter out the commits that are not matched by commit parsers
filter_commits = true
ignore_tags="v*-(beta|rc)*"
# glob pattern for matching git tags
tag_pattern = "v[0-9]*"
tag_pattern = "v[0-9]*"
8 changes: 8 additions & 0 deletions remote/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
7 changes: 7 additions & 0 deletions remote/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"defaultLocale": "en",
"hostname": null,
"port": null,
"instancesDB": "browser",
"instances": []
}
1 change: 0 additions & 1 deletion src/store/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ export const actions: ActionTree<RootState, RootState> = {
importConfigJson({ commit }, payload: ConfigJson) {
type RootStateInstancesDbType = 'moonraker' | 'browser' | 'json'
let instancesDB: RootStateInstancesDbType = payload.instancesDB ?? 'moonraker'
if (document.location.hostname === 'my.mainsail.xyz') instancesDB = 'browser'
if (import.meta.env.VUE_APP_INSTANCES_DB)
instancesDB = import.meta.env.VUE_APP_INSTANCES_DB as RootStateInstancesDbType

Expand Down