Skip to content

Commit

Permalink
chore: improve release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Dec 21, 2022
1 parent 6b2b33d commit 830cff1
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 52 deletions.
43 changes: 22 additions & 21 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: '🐞 Bug report'
name: 🐞 Bug report
description: File a report to help us improve
labels: ['bug']
labels:
- bug
body:
- type: markdown
attributes:
Expand All @@ -12,44 +13,44 @@ body:
Use [markdown codeblocks](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) when posting code samples.
You can quickly create a demo by forking the [basic demo](https://photo-sphere-viewer.js.org/demos/basic/1-zero-config.html) to jsFiddle, Codepen or CodeSandbox.
- type: textarea
- id: description
type: textarea
attributes:
label: Describe the bug
placeholder: Provide a clear description of the bug, with tests cases and steps to reproduce.
validations:
required: true

- type: input
- id: url
type: input
attributes:
label: Online demo URL

- type: dropdown
- id: version
type: dropdown
attributes:
label: Photo Sphere Viewer version
options:
- '5.0.0'
- '4.8.1'
- '4.8.0'
- '4.7.3'
- '4.7.2'
- '4.7.1'
- '4.7.0'
- 5.0.0
- 4.8.1
- 4.8.0
- 4.7.3
- 4.7.2
- 4.7.1
- 4.7.0
- other
validations:
required: true

- type: input
- id: plugins
type: input
attributes:
label: Plugins loaded

- type: input
- id: os-browser
type: input
attributes:
label: OS & browser
validations:
required: true

- type: textarea
- id: context
type: textarea
attributes:
label: Additional context
placeholder: Add any other context about the problem here.
17 changes: 9 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: '🚀 Feature request'
name: 🚀 Feature request
description: Suggest an idea for this project
labels: ['feature']
labels:
- feature
body:
- type: markdown
attributes:
Expand All @@ -12,20 +13,20 @@ body:
Consider searching [the documentation](https://photo-sphere-viewer.js.org/guide/) to verify the feature does not already exists.
Use [markdown codeblocks](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) when posting code samples.
- type: textarea
- id: description
type: textarea
attributes:
label: Describe the feature
placeholder: A clear and complete description of the feature you'd like to see in Photo Sphere Viewer.
validations:
required: true

- type: textarea
- id: alternatives
type: textarea
attributes:
label: Alternatives you've considered
placeholder: A description of any alternative solutions or features you've considered. If possible provided an online demo of your progression.

- type: textarea
- id: context
type: textarea
attributes:
label: Additional context
placeholder: Add any other context about the feature request here.
41 changes: 21 additions & 20 deletions .github/ISSUE_TEMPLATE/support_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: '🆘 Support request'
name: 🆘 Support request
description: If you need help to use this library
labels: ['question']
labels:
- question
body:
- type: markdown
attributes:
Expand All @@ -12,38 +13,38 @@ body:
Consider searching [the documentation](https://photo-sphere-viewer.js.org/guide/) to find the solution by yourself.
Use [markdown codeblocks](https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks) when posting code samples.
- type: textarea
- id: description
type: textarea
attributes:
label: Describe your problem
placeholder: A clear description of what you want to achieve and what you already tried. If possible provided an online demo of your progression.
validations:
required: true

- type: input
- id: url
type: input
attributes:
label: Online demo URL

- type: dropdown
- id: version
type: dropdown
attributes:
label: Photo Sphere Viewer version
options:
- '5.0.0'
- '4.8.1'
- '4.8.0'
- '4.7.3'
- '4.7.2'
- '4.7.1'
- '4.7.0'
- 5.0.0
- 4.8.1
- 4.8.0
- 4.7.3
- 4.7.2
- 4.7.1
- 4.7.0
- other
validations:
required: true

- type: input
- id: plugins
type: input
attributes:
label: Plugins loaded

- type: textarea
- id: context
type: textarea
attributes:
label: Additional context
placeholder: Add any other context about the feature request here.
placeholder: Add any other context about the request here.
3 changes: 1 addition & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ updates:
- dependency-name: '*'
update-types: ['version-update:semver-patch']
commit-message:
prefix: 'deps'
prefix-development: 'deps-dev'
prefix: 'chore'
include: 'scope'
18 changes: 18 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,21 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_TAG: ${{ steps.npm_tag.outputs.NPM_TAG || 'latest' }}

- uses: Akkjon/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
milestone_name: ${{ github.ref_name }}
crash_on_missing: false

- name: update issue templates
run: |
git fetch origin main --depth 1
git checkout main
node ./build/update-issue-templates.mjs ${{ github.ref_name }}
git stage .github/ISSUE_TEMPLATE
git config --global user.email "[email protected]"
git config --global user.name "github-actions"
git commit -m "chore: add ${{ github.ref_name }} to issue templates"
git push
5 changes: 5 additions & 0 deletions build/prepare-package.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/usr/bin/env node

/**
* Copy the contents of each package "dist" folders to a root "dist" folder
* In order to prepare the creation of the release ZIP
*/

import path from 'path';
import fs from 'fs-extra';

Expand Down
53 changes: 53 additions & 0 deletions build/update-issue-templates.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env node

/**
* Add the version provided as first parameter to the options of the issue templates
*/

import fs from 'fs';
import yaml from 'yaml';

const VERSION = process.argv[2];
const MAX_VERSIONS = 10;
const OTHER_LABEL = 'other';

if (!VERSION) {
console.warn('No version provided');
process.exit(0);
}

[
'.github/ISSUE_TEMPLATE/bug_report.yml',
'.github/ISSUE_TEMPLATE/support_request.yml',
]
.forEach(filename => {
if (!fs.existsSync(filename)) {
console.warn(`${filename} does not exists`);
return;
}

const content = yaml.parse(fs.readFileSync(filename, { encoding: 'utf8' }));

const item = content.body.find(({ id }) => id === 'version');
if (!item) {
console.warn(`Dropdown not found in ${filename}`);
return;
}

const versions = item.attributes.options.filter(v => v !== OTHER_LABEL);
if (versions.indexOf(VERSION) !== -1) {
console.warn(`Version ${VERSION} already exists in ${filename}`);
return;
}

console.log(`Add ${VERSION} in ${filename}`);
versions.unshift(VERSION);
if (versions.length > MAX_VERSIONS) {
versions.splice(MAX_VERSIONS, versions.length - MAX_VERSIONS);
}
versions.push(OTHER_LABEL);

item.attributes.options = versions;

fs.writeFileSync(filename, yaml.stringify(content, { lineWidth: 0 }));
});
2 changes: 1 addition & 1 deletion docs/guide/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Path to the panorama. Must be a single URL for the default equirectangular adapt

- default: `equirectangular`

Which [adapter](./adapters) used to load the panorama.
Which [adapter](./adapters/) used to load the panorama.

#### `plugins`

Expand Down

0 comments on commit 830cff1

Please sign in to comment.