Skip to content

Commit fb12453

Browse files
authored
Create action (#1)
2 parents b399216 + a1c4314 commit fb12453

File tree

9 files changed

+576
-3
lines changed

9 files changed

+576
-3
lines changed

.github/dependabot.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: npm
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
day: monday
8+
time: "06:00"
9+
reviewers:
10+
- cloudnode-pro/development
11+
- package-ecosystem: github-actions
12+
directory: /
13+
schedule:
14+
interval: weekly
15+
day: monday
16+
time: "06:00"
17+
reviewers:
18+
- cloudnode-pro/development

.github/workflows/build.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
registry-url: https://registry.npmjs.org/
22+
cache: npm
23+
24+
- name: Install latest NPM
25+
run: npm i -g npm@latest
26+
27+
- name: Install dependencies
28+
run: npm ci
29+
30+
- name: Build
31+
run: npm run build

.github/workflows/codeql.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: "CodeQL"
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
schedule:
9+
- cron: "0 6 * * 1"
10+
11+
jobs:
12+
analyze:
13+
name: Analyse (${{ matrix.language }})
14+
runs-on: 'ubuntu-latest'
15+
timeout-minutes: 360
16+
permissions:
17+
security-events: write
18+
packages: read
19+
actions: read
20+
contents: read
21+
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
language: [javascript-typescript]
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Initialise CodeQL
32+
uses: github/codeql-action/init@v3
33+
with:
34+
languages: ${{ matrix.language }}
35+
build-mode: ${{ matrix.build-mode }}
36+
37+
- name: Perform CodeQL analysis
38+
uses: github/codeql-action/analyze@v3
39+
with:
40+
category: "/language:${{matrix.language}}"

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:20
2+
WORKDIR /action
3+
COPY . .
4+
RUN npm install -g npm@latest
5+
RUN npm ci
6+
RUN npm run build
7+
ENTRYPOINT ["node", "/action/dist/index.js"]

README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Release: Upload Asset
2+
3+
Upload files to a GitHub release.
4+
5+
## Example Usage
6+
7+
```yaml
8+
#
9+
steps:
10+
#
11+
- name: Upload to release
12+
uses: cloudnode-pro/[email protected]
13+
with:
14+
# See the ‘Inputs’ section below for details.
15+
release-id: 123456 # Optional for `release` events.
16+
files: |
17+
path/to/file.txt; type=text/plain; name=File1.txt
18+
path/to/foo/bar.baz; if=${{ github.event_name == 'release' }}
19+
```
20+
21+
## Inputs
22+
23+
### `release-id`
24+
25+
The ID of the release to which to upload files.
26+
27+
This is optional for `release` events, in which case the ID can be inferred (if left unset) from the release that
28+
triggered the workflow.
29+
30+
### `files`
31+
32+
Paths to the files to upload. Separated by newline.
33+
34+
After the file path, you can add parameters separated by semicolons.
35+
36+
The recognised parameters are:
37+
38+
<dl>
39+
<dt><code>type</code></dt>
40+
<dd>The MIME type of the file. Defaults to <code>application/octet-stream</code>.
41+
<dt><code>name</code></dt>
42+
<dd>The name of the file. Defaults to the basename of the file path.</dd>
43+
<dt><code>if</code></dt>
44+
<dd>Whether to actually upload this file. You can use this in combination with
45+
<a href="https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/evaluate-expressions-in-workflows-and-actions">GitHub expressions</a>.
46+
The allowed values are <code>true</code> and <code>false</code>. Defaults to <code>true</code>.
47+
</dd>
48+
</dl>
49+
50+
Examples:
51+
52+
```yaml
53+
files: |-
54+
/path/to/file1.txt
55+
/path/to/file2.txt; type=text/plain; name=Named File.txt
56+
/path/to/file3.txt; if=${{ 'foo' == 'bar' }}
57+
```
58+
59+
60+

action.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release Upload Asset
2+
description: Upload files to a GitHub release
3+
inputs:
4+
release-id:
5+
description: The ID of the release to which to upload files.
6+
required: false
7+
files:
8+
description: Paths to the files to upload. Separated by newline.
9+
required: true
10+
runs:
11+
using: docker
12+
image: Dockerfile
13+
env:
14+
GH_INPUTS: ${{ toJSON(inputs) }}
15+
16+
branding:
17+
icon: upload
18+
color: blue

0 commit comments

Comments
 (0)