Skip to content

Commit 6e18f64

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

File tree

5 files changed

+44
-47
lines changed

5 files changed

+44
-47
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: 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+
runs-on: [ubuntu-latest]
1919
fail-fast: false
2020

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

.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

packages/cache/__tests__/saveCache.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ test('save with small cache outputs should fail on changed limit', async () => {
102102
expect(cacheId).toBe(-1)
103103
expect(logWarningMock).toHaveBeenCalledTimes(1)
104104
expect(logWarningMock).toHaveBeenCalledWith(
105-
'Failed to save: Cache size of ~1024 MB (1048576 B) is over the 100MB limit, not saving cache.'
105+
'Failed to save: Cache size of ~1024 MB (1073741824 B) is over the 100MB limit, not saving cache.'
106106
)
107107

108108
const archiveFolder = '/foo/bar'

0 commit comments

Comments
 (0)