Skip to content

Commit aef81f8

Browse files
author
Calvin Allen
committed
Update workflows
Update tests Update dotfiles and configs Remove src and dist Add source and dist Update actual action Revert "Update actual action" This reverts commit b334cf8. Add supporting files Real action file Update branding
1 parent f68e4e3 commit aef81f8

19 files changed

+9800
-681
lines changed

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ updates:
33
- package-ecosystem: github-actions
44
directory: /
55
schedule:
6-
interval: daily
6+
interval: monthly
77

88
- package-ecosystem: npm
99
directory: /
1010
schedule:
11-
interval: daily
11+
interval: monthly

.github/workflows/check-dist.yml

Lines changed: 0 additions & 53 deletions
This file was deleted.

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/test.yml

Lines changed: 0 additions & 24 deletions
This file was deleted.

CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

LICENSE

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,9 @@
1-
21
The MIT License (MIT)
32

4-
Copyright (c) 2018 GitHub, Inc. and contributors
3+
Copyright © 2023 Calvin A. Allen
54

6-
Permission is hereby granted, free of charge, to any person obtaining a copy
7-
of this software and associated documentation files (the "Software"), to deal
8-
in the Software without restriction, including without limitation the rights
9-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
copies of the Software, and to permit persons to whom the Software is
11-
furnished to do so, subject to the following conditions:
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
126

13-
The above copyright notice and this permission notice shall be included in
14-
all copies or substantial portions of the Software.
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
158

16-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
THE SOFTWARE.
9+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 27 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,105 +1,41 @@
1-
<p align="center">
2-
<a href="https://github.com/actions/typescript-action/actions"><img alt="typescript-action status" src="https://github.com/actions/typescript-action/workflows/build-test/badge.svg"></a>
3-
</p>
1+
# calvinallen/action-vs-vsix-versioner
42

5-
# Create a JavaScript Action using TypeScript
3+
Github Action to update your Visual Studio extension to a version that is based off of the current date and the CI build number.
64

7-
Use this template to bootstrap the creation of a TypeScript action.:rocket:
5+
> *This action requires your extension to utilize the [VSIX Synchronizer](https://marketplace.visualstudio.com/items?itemName=MadsKristensen.VsixSynchronizer64) model for managing the version in the `source.extension.vsixmanifest` and the `source.extension.cs` code-behind file that is automatically synchronized.*
6+
>
7+
> *Other versioning styles will be supported in the future*
88
9-
This template includes compilation support, tests, a validation workflow, publishing, and versioning guidance.
9+
## Usage
1010

11-
If you are new, there's also a simpler introduction. See the [Hello World JavaScript Action](https://github.com/actions/hello-world-javascript-action)
11+
You can use the Visual Studio VSIX Versioner GitHub Action by configuring a YAML-based workflow file, e.g. .github/workflows/deploy.yml.
1212

13-
## Create an action from this template
13+
> *This action only works on a Windows-based runner*
1414
15-
Click the `Use this Template` and provide the new repo details for your action
15+
## Version the VSIX *befre* building
1616

17-
## Code in Main
17+
```yml
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
1821

19-
> First, you'll need to have a reasonably modern version of `node` handy. This won't work with versions older than 9, for instance.
22+
- name: Visual Studio VSIX Versioner
23+
uses: CalvinAllen/action-vs-vsix-versioner@v1
24+
with:
25+
# REQUIRED
26+
extension-manifest-file: './src/CodingWithCalvin.OpenBinFolder.Vsix/source.extension.vsixmanifest'
27+
extension-source-file: './src/CodingWithCalvin.OpenBinFolder.Vsix/source.extension.cs'
2028

21-
Install the dependencies
22-
```bash
23-
$ npm install
24-
```
25-
26-
Build the typescript and package it for distribution
27-
```bash
28-
$ npm run build && npm run package
29-
```
30-
31-
Run the tests :heavy_check_mark:
32-
```bash
33-
$ npm test
34-
35-
PASS ./index.test.js
36-
✓ throws invalid number (3ms)
37-
wait 500 ms (504ms)
38-
test runs (95ms)
39-
40-
...
41-
```
42-
43-
## Change action.yml
44-
45-
The action.yml defines the inputs and output for your action.
46-
47-
Update the action.yml with your name, description, inputs and outputs for your action.
48-
49-
See the [documentation](https://help.github.com/en/articles/metadata-syntax-for-github-actions)
50-
51-
## Change the Code
52-
53-
Most toolkit and CI/CD operations involve async operations so the action is run in an async function.
54-
55-
```javascript
56-
import * as core from '@actions/core';
57-
...
29+
# OPTIONAL
30+
build-number: ${{ github.run_number }}
5831

59-
async function run() {
60-
try {
61-
...
62-
}
63-
catch (error) {
64-
core.setFailed(error.message);
65-
}
66-
}
6732

68-
run()
6933
```
7034

71-
See the [toolkit documentation](https://github.com/actions/toolkit/blob/master/README.md#packages) for the various packages.
72-
73-
## Publish to a distribution branch
74-
75-
Actions are run from GitHub repos so we will checkin the packed dist folder.
76-
77-
Then run [ncc](https://github.com/zeit/ncc) and push the results:
78-
```bash
79-
$ npm run package
80-
$ git add dist
81-
$ git commit -a -m "prod dependencies"
82-
$ git push origin releases/v1
83-
```
84-
85-
Note: We recommend using the `--license` option for ncc, which will create a license file for all of the production node modules used in your project.
86-
87-
Your action is now published! :rocket:
88-
89-
See the [versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
90-
91-
## Validate
92-
93-
You can now validate the action by referencing `./` in a workflow in your repo (see [test.yml](.github/workflows/test.yml))
94-
95-
```yaml
96-
uses: ./
97-
with:
98-
milliseconds: 1000
99-
```
100-
101-
See the [actions tab](https://github.com/actions/typescript-action/actions) for runs of this action! :rocket:
102-
103-
## Usage:
35+
## Inputs
10436

105-
After testing you can [create a v1 tag](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) to reference the stable and latest V1 action
37+
| Input | Required | Description |
38+
| ------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------- |
39+
| extension-manifest-file | Y | Path to the manifest used for the extension |
40+
| extension-source-file | Y | Path to the source file generated from the manifest (using VSIX Syncronizer) |
41+
| build-number | N | Specify the build number you'd like to utilize, otherwise, defaults to the `run_number` of the build itself |

__tests__/main.test.ts

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,5 @@
1-
import {wait} from '../src/wait'
2-
import * as process from 'process'
3-
import * as cp from 'child_process'
4-
import * as path from 'path'
51
import {expect, test} from '@jest/globals'
62

73
test('throws invalid number', async () => {
8-
const input = parseInt('foo', 10)
9-
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
10-
})
11-
12-
test('wait 500 ms', async () => {
13-
const start = new Date()
14-
await wait(500)
15-
const end = new Date()
16-
var delta = Math.abs(end.getTime() - start.getTime())
17-
expect(delta).toBeGreaterThan(450)
18-
})
19-
20-
// shows how the runner will run a javascript action with env / stdout protocol
21-
test('test runs', () => {
22-
process.env['INPUT_MILLISECONDS'] = '500'
23-
const np = process.execPath
24-
const ip = path.join(__dirname, '..', 'lib', 'main.js')
25-
const options: cp.ExecFileSyncOptions = {
26-
env: process.env
27-
}
28-
console.log(cp.execFileSync(np, [ip], options).toString())
4+
expect(true).toBeTruthy();
295
})

action-types.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
inputs:
2+
extension-manifest-file:
3+
type: string
4+
extension-source-file:
5+
type: string
6+
build-number:
7+
type: number
8+
outputs:
9+
version:
10+
type: string

action.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,19 @@
1-
name: 'Your name here'
2-
description: 'Provide a description here'
3-
author: 'Your name or organization here'
1+
name: 'Visual Studio VSIX Versioner'
2+
description: 'Version your Visual Studio extension with ease!'
3+
author: 'Coding with Calvin'
4+
branding:
5+
color: purple
6+
icon: zap
47
inputs:
5-
milliseconds: # change this
8+
extension-manifest-file:
69
required: true
7-
description: 'input description here'
8-
default: 'default value if applicable'
10+
description: 'Path to your source.extension.vsixmanifest file'
11+
extension-source-file:
12+
required: true
13+
description: 'Path to the source file generated from the manifest (using VSIX Syncronizer)'
14+
build-number:
15+
required: false
16+
description: 'Specify the build number you would like to utilize for the generated version.'
917
runs:
1018
using: 'node16'
1119
main: 'dist/index.js'

0 commit comments

Comments
 (0)