Skip to content

Commit 7bbec4d

Browse files
Refactor CI/CD workflow for npm package publishing and update README with NPM_TOKEN instruction
1 parent c2968c2 commit 7bbec4d

2 files changed

Lines changed: 13 additions & 22 deletions

File tree

.github/workflows/cd.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,21 @@ permissions:
1111
packages: write
1212

1313
jobs:
14-
build_and_push:
14+
publish:
1515
runs-on: ubuntu-latest
1616
steps:
1717
- name: Checkout
1818
uses: actions/checkout@v4
19-
20-
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v3
22-
23-
- name: Build and export
24-
uses: docker/build-push-action@v6
25-
env:
26-
DOCKER_BUILD_SUMMARY: false
27-
with:
28-
tags: ghcr.io/decatur-robotics/gearbox:latest
29-
outputs: type=docker,dest=/tmp/gearbox.tar
30-
context: . # Needed for Docker to find files made during the workflow
31-
32-
- name: Load image
19+
20+
- name: Setup Node.js environment
21+
uses: actions/setup-node@v4.1.0
22+
23+
- name: Install dependencies
24+
run: npm install
25+
26+
- name: "Create .npmrc"
3327
run: |
34-
docker load --input /tmp/gearbox.tar
35-
docker image ls -a
36-
37-
- name: Sign in to GHCR
38-
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u decatur-robotics --password-stdin
28+
echo "registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> .npmrc
3929
40-
- name: Push to GHCR
41-
run: docker push ghcr.io/decatur-robotics/gearbox:latest
30+
- name: Publish package
31+
run: npm publish

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@ To get started, use this repo as a template and do the following:
44

55
- Update the details in package.json
66
- Update the assignees in .github/dependabot.yml
7+
- Add your NPM_TOKEN to the repository secrets
78

89
NPM Package Template © 2024 by Decatur Robotics is licensed under CC BY 4.0

0 commit comments

Comments
 (0)