Skip to content

Commit dc326b8

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

File tree

5 files changed

+23
-45
lines changed

5 files changed

+23
-45
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: 19 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,18 @@ 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:
1317
test:
14-
runs-on: macos-latest-large
15-
18+
runs-on: ubuntu-latest
19+
environment: npm-publish
20+
permissions:
21+
contents: read
22+
id-token: write
1623
steps:
1724
- name: setup repo
1825
uses: actions/checkout@v4
@@ -35,51 +42,22 @@ jobs:
3542
run: npm run build
3643

3744
- name: test
45+
if: ${{ github.event.inputs.test }}
3846
run: npm run test
3947

4048
- name: pack
4149
run: npm pack
4250
working-directory: packages/${{ github.event.inputs.package }}
4351

44-
- name: upload artifact
45-
uses: actions/upload-artifact@v4
52+
- name: Create versions
53+
id: versions
54+
uses: voplica/sem-ver-action@v1.0.4
4655
with:
47-
name: ${{ github.event.inputs.package }}
48-
path: packages/${{ github.event.inputs.package }}/*.tgz
49-
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:
56+
gitHubToken: "${{ secrets.GITHUB_TOKEN }}"
5857

59-
- name: download artifact
60-
uses: actions/download-artifact@v4
58+
- uses: JS-DevTools/npm-publish@v3
6159
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
70-
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
83-
env:
84-
SLACK_WEBHOOK: ${{ secrets.SLACK }}
85-
60+
token: ${{ secrets.GITHUB_TOKEN }}
61+
registry: "https://npm.pkg.github.com"
62+
provenance: true
63+
tag: "${{ steps.versions.outputs.ver_semVerNoMeta }}"

.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)