Skip to content

Commit d5a8445

Browse files
committed
Allow publishing to GitHub Registry
Signed-off-by: Voplica <admin@voplica.com>
1 parent ea93af5 commit d5a8445

File tree

86 files changed

+199
-202
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+199
-202
lines changed

.github/workflows/artifact-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
runs-on: [ubuntu-latest, windows-latest, macos-latest]
18+
[ubuntu-latest]
1919
fail-fast: false
2020

2121
runs-on: ${{ matrix.runs-on }}

.github/workflows/cache-tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
runs-on: [ubuntu-latest, windows-latest, macOS-latest]
18+
runs-on: [ubuntu-latest]
1919
fail-fast: false
2020

2121
runs-on: ${{ matrix.runs-on }}
@@ -53,7 +53,7 @@ jobs:
5353
shell: bash
5454
run: packages/cache/__tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
5555

56-
# We're using node -e to call the functions directly available in the @actions/cache package
56+
# We're using node -e to call the functions directly available in the @voplica/cache package
5757
- name: Save cache using saveCache()
5858
run: |
5959
node -e "Promise.resolve(require('./packages/cache/lib/cache').saveCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}'))"

.github/workflows/cache-windows-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
shell: bash
5353
run: packages/cache/__tests__/create-cache-files.sh ${{ runner.os }} ~/test-cache
5454

55-
# We're using node -e to call the functions directly available in the @actions/cache package
55+
# We're using node -e to call the functions directly available in the @voplica/cache package
5656
- name: Save cache using saveCache()
5757
run: |
5858
node -e "Promise.resolve(require('./packages/cache/lib/cache').saveCache(['test-cache','~/test-cache'],'test-${{ runner.os }}-${{ github.run_id }}'))"

.github/workflows/releases.yml

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,19 @@ on:
88
package:
99
required: true
1010
description: 'core, artifact, cache, exec, github, glob, http-client, io, tool-cache, attest'
11+
test:
12+
default: true
13+
type: boolean
14+
description: 'If tests step is enabled'
1115

1216
jobs:
13-
test:
14-
runs-on: macos-latest-large
15-
17+
publish:
18+
runs-on: ubuntu-latest
19+
environment: npm-publish
20+
permissions:
21+
contents: write
22+
id-token: write
23+
packages: write
1624
steps:
1725
- name: setup repo
1826
uses: actions/checkout@v4
@@ -24,62 +32,51 @@ jobs:
2432
uses: actions/setup-node@v4
2533
with:
2634
node-version: 20.x
35+
registry-url: https://npm.pkg.github.com/
36+
37+
- name: Create versions
38+
id: versions
39+
uses: voplica/sem-ver-action@v1.0.4
40+
with:
41+
gitHubToken: "${{ secrets.GITHUB_TOKEN }}"
42+
43+
- name: setup authentication
44+
run: echo "//npm.pkg.github.com/:_authToken=${NPM_TOKEN}" >> .npmrc
45+
env:
46+
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2747

2848
- name: npm install
2949
run: npm install
3050

51+
- name: TS-Node - Update Package Version
52+
run: npm version v${{ steps.versions.outputs.ver_semVerNoMeta }} --allow-same-version
53+
working-directory: packages/${{ github.event.inputs.package }}
54+
3155
- name: bootstrap
3256
run: npm run bootstrap
3357

3458
- name: build
3559
run: npm run build
3660

3761
- name: test
38-
run: npm run test
62+
run: |
63+
if [[ "${{ github.event.inputs.test }}" == "true" ]]; then
64+
npm run test
65+
fi
66+
67+
- name: set registry
68+
run: npm config set registry https://npm.pkg.github.com/
3969

4070
- name: pack
4171
run: npm pack
4272
working-directory: packages/${{ github.event.inputs.package }}
4373

44-
- name: upload artifact
45-
uses: actions/upload-artifact@v4
46-
with:
47-
name: ${{ github.event.inputs.package }}
48-
path: packages/${{ github.event.inputs.package }}/*.tgz
74+
- name: set registry
75+
run: npm config set registry https://npm.pkg.github.com/
4976

50-
publish:
51-
runs-on: macos-latest-large
52-
needs: test
53-
environment: npm-publish
54-
permissions:
55-
contents: read
56-
id-token: write
57-
steps:
58-
59-
- name: download artifact
60-
uses: actions/download-artifact@v4
61-
with:
62-
name: ${{ github.event.inputs.package }}
63-
64-
- name: setup authentication
65-
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
66-
env:
67-
NPM_TOKEN: ${{ secrets.TOKEN }}
68-
69-
- name: publish
77+
- name: Publishing Package
7078
run: npm publish --provenance *.tgz
71-
72-
- name: notify slack on failure
73-
if: failure()
74-
run: |
75-
curl -X POST -H 'Content-type: application/json' --data '{"text":":pb__failed: Failed to publish a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK
76-
env:
77-
SLACK_WEBHOOK: ${{ secrets.SLACK }}
78-
79-
- name: notify slack on success
80-
if: success()
81-
run: |
82-
curl -X POST -H 'Content-type: application/json' --data '{"text":":dance: Successfully published a new version of ${{ github.event.inputs.package }}"}' $SLACK_WEBHOOK
8379
env:
84-
SLACK_WEBHOOK: ${{ secrets.SLACK }}
85-
80+
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
81+
NODE_OPTIONS: --max_old_space_size=4096
82+
working-directory: packages/${{ github.event.inputs.package }}

.github/workflows/unit-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616

1717
strategy:
1818
matrix:
19-
runs-on: [ubuntu-latest, macos-latest-large, windows-latest]
19+
runs-on: [ubuntu-latest]
2020

2121
# Node 18 is the current default Node version in hosted runners, so users may still use the toolkit with it when running tests (see https://github.com/actions/toolkit/issues/1841)
2222
# Node 20 is the currently support Node version for actions - https://docs.github.com/actions/sharing-automations/creating-actions/metadata-syntax-for-github-actions#runsusing-for-javascript-actions

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ The GitHub Actions ToolKit provides a set of packages to make creating actions e
1919

2020
## Packages
2121

22-
:heavy_check_mark: [@actions/core](packages/core)
22+
:heavy_check_mark: [@voplica/core](packages/core)
2323

2424
Provides functions for inputs, outputs, results, logging, secrets and variables. Read more [here](packages/core)
2525

2626
```bash
27-
$ npm install @actions/core
27+
$ npm install @voplica/core
2828
```
2929
<br/>
3030

@@ -68,7 +68,7 @@ $ npm install @actions/io
6868

6969
Provides functions for downloading and caching tools. e.g. setup-* actions. Read more [here](packages/tool-cache)
7070

71-
See @actions/cache for caching workflow dependencies.
71+
See @voplica/cache for caching workflow dependencies.
7272

7373
```bash
7474
$ npm install @actions/tool-cache
@@ -93,12 +93,12 @@ $ npm install @actions/artifact
9393
```
9494
<br/>
9595

96-
:dart: [@actions/cache](packages/cache)
96+
:dart: [@voplica/cache](packages/cache)
9797

9898
Provides functions to cache dependencies and build outputs to improve workflow execution time. Read more [here](packages/cache)
9999

100100
```bash
101-
$ npm install @actions/cache
101+
$ npm install @voplica/cache
102102
```
103103
<br/>
104104

@@ -176,7 +176,7 @@ Tests: 3 passed, 3 total
176176
Walkthrough creating a TypeScript Action with compilation, tests, linting, workflow, publishing, and versioning.
177177
178178
```javascript
179-
import * as core from '@actions/core';
179+
import * as core from '@voplica/core';
180180

181181
async function run() {
182182
try {

docs/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ function setSecret(secret: string): void {}
5151
Now, future logs containing BAR will be masked. E.g. running `echo "Hello FOO BAR World"` will now print `Hello FOO **** World`.
5252

5353
**WARNING** The add-mask and setSecret commands only support single-line
54-
secrets or multi-line secrets that have been escaped. `@actions/core`
54+
secrets or multi-line secrets that have been escaped. `@voplica/core`
5555
`setSecret` will escape the string you provide by default. When an escaped
5656
multi-line string is provided the whole string and each of its lines
5757
individually will be masked. For example you can mask `first\nsecond\r\nthird`

docs/github-package.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This walkthrough assumes that you have gone through the basic [javascript action
1414

1515
All of the dependencies we need should come packaged for us in this library's core and github packages. To install, run the following in your action:
1616

17-
`npm install @actions/core && npm install @actions/github`
17+
`npm install @voplica/core && npm install @actions/github`
1818

1919
## Metadata
2020

@@ -41,7 +41,7 @@ runs:
4141
Now that we've installed our dependencies and defined our inputs, we're ready to start writing the action logic in `src/main.ts`! For clarity, we'll structure our action up as follows:
4242

4343
```ts
44-
import * as core from '@actions/core';
44+
import * as core from '@voplica/core';
4545
import * as github from '@actions/github';
4646
4747
export async function run() {
@@ -84,7 +84,7 @@ if (github.context.payload.action !== 'opened') {
8484
Our whole `src/main.ts` file now looks like:
8585

8686
```ts
87-
import * as core from '@actions/core';
87+
import * as core from '@voplica/core';
8888
import * as github from '@actions/github';
8989
9090
export async function run() {
@@ -126,7 +126,7 @@ await client.issues.createComment({
126126
For more docs on the client, you can visit the [Octokit REST documentation](https://octokit.github.io/rest.js/). Now our action code should be complete:
127127

128128
```ts
129-
import * as core from '@actions/core';
129+
import * as core from '@voplica/core';
130130
import * as github from '@actions/github';
131131
132132
export async function run() {

packages/artifact/RELEASES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122

123123
### 0.4.1
124124

125-
- Update to latest @actions/core version
125+
- Update to latest @voplica/core version
126126

127127
### 0.4.0
128128

packages/artifact/__tests__/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import * as core from '@actions/core'
1+
import * as core from '@voplica/core'
22

33
// noopLogs mocks the console.log and core.* functions to prevent output in the console while testing
44
export const noopLogs = (): void => {

0 commit comments

Comments
 (0)