Skip to content

Commit 4fe9424

Browse files
authored
chore: fix-up & tidy-up workflows and remove references to .npmrc registry changes (#260)
1 parent 06853ec commit 4fe9424

File tree

8 files changed

+14
-78
lines changed

8 files changed

+14
-78
lines changed

.github/workflows/integration.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
12
---
23
name: Integration
34

.github/workflows/pr-validation.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
2+
---
13
name: Validate PR
24

35
on:
@@ -14,6 +16,7 @@ jobs:
1416
- uses: amannn/action-semantic-pull-request@v5
1517
env:
1618
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
1720
commit-message-validation:
1821
name: Validate commit messages
1922
runs-on: ubuntu-latest
@@ -27,13 +30,6 @@ jobs:
2730
uses: actions/setup-node@v4
2831
with:
2932
node-version: 20
30-
registry-url: 'https://npm.pkg.github.com'
31-
env:
32-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33-
34-
- name: Create .npmrc
35-
run: |
36-
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc
3733

3834
- name: Install commitlint
3935
run: |

.github/workflows/pr.yml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
12
---
23
name: Pull request build
34

@@ -29,13 +30,6 @@ jobs:
2930
with:
3031
node-version: ${{ matrix.node }}
3132
cache: npm
32-
registry-url: 'https://npm.pkg.github.com'
33-
env:
34-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35-
36-
- name: Create .npmrc
37-
run: |
38-
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc
3933

4034
- name: Enable Corepack
4135
run: corepack enable

.github/workflows/release.yml

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
12
---
23
name: Release
34

@@ -23,21 +24,13 @@ jobs:
2324
- name: Checkout sources
2425
uses: actions/checkout@v4
2526
with:
26-
ssh-key: ${{ secrets.DEPLOY_KEY }}
2727
fetch-depth: 0
2828

2929
- name: Install node 18
3030
uses: actions/setup-node@v4
3131
with:
3232
node-version: 18
3333
cache: npm
34-
registry-url: 'https://npm.pkg.github.com'
35-
env:
36-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37-
38-
- name: Create .npmrc
39-
run: |
40-
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc
4134

4235
- name: Configure git
4336
run: |
@@ -74,7 +67,7 @@ jobs:
7467

7568
- name: Publish package
7669
env:
77-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
7871
run: npm publish
7972

8073
- name: Commit and push package modifications
@@ -93,10 +86,10 @@ jobs:
9386
uses: actions/github-script@v6
9487
id: release-notes
9588
with:
96-
github-token: ${{ secrets.STAGING_PAT }}
89+
github-token: ${{ secrets.GITHUB_TOKEN }}
9790
script: |
9891
const repo_name = context.payload.repository.full_name
99-
const response = await github.request('POST /repos/' + repo_name + '/releases' + '/generate-notes', {
92+
const response = await github.request('POST /repos/' + repo_name + '/releases/generate-notes', {
10093
tag_name: '${{ steps.bump.outputs.version }}',
10194
previous_tag_name: '${{ steps.fetch-tag.outputs.oldest-tag != '' && steps.fetch-tag.outputs.oldest-tag || steps.last-release.outputs.base-tag }}'
10295
})
@@ -105,7 +98,7 @@ jobs:
10598
- name: Create a release
10699
uses: actions/github-script@v6.4.1
107100
with:
108-
github-token: ${{ secrets.STAGING_PAT }}
101+
github-token: ${{ secrets.GITHUB_TOKEN }}
109102
script: |
110103
const repo_name = context.payload.repository.full_name
111104
const response = await github.request('POST /repos/' + repo_name + '/releases', {

.github/workflows/stage.yml

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
12
---
23
name: Stage
34

@@ -22,29 +23,21 @@ on:
2223
jobs:
2324
stage:
2425
runs-on: ubuntu-latest
25-
# Branches that starts with `release/` shouldn't trigger this workflow, as these are triggering the release workflow.
26+
# Branches that starts with `release/` shouldn't trigger this workflow, as these are triggering the release workflow.
2627
if: github.repository_owner == 'guacsec' && github.event.pull_request.merged == true && !startsWith(github.head_ref, 'release/')
2728
environment: staging
2829
name: Stage the project
2930
steps:
3031
- name: Checkout sources
3132
uses: actions/checkout@v4
3233
with:
33-
ssh-key: ${{ secrets.DEPLOY_KEY }}
3434
fetch-depth: 0
3535

3636
- name: Install node 18
3737
uses: actions/setup-node@v4
3838
with:
3939
node-version: 18
4040
cache: npm
41-
registry-url: 'https://npm.pkg.github.com'
42-
env:
43-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
45-
- name: Create .npmrc
46-
run: |
47-
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc
4841

4942
- name: Enable Corepack
5043
run: corepack enable
@@ -131,7 +124,7 @@ jobs:
131124
132125
- name: Publish package
133126
env:
134-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
135128
run: npm publish
136129

137130
- name: Commit and push package modifications

README.md

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,8 @@
44
* Looking for our Java API? Try [Exhort Java API](https://github.com/guacsec/exhort-java-api).
55
* Looking for our Backend implementation? Try [Exhort](https://github.com/guacsec/exhort).
66

7-
The _Exhort JavaScript API_ module is deployed to _GitHub Package Registry_.
8-
9-
<details>
10-
<summary>Click here for configuring <em>GHPR</em> registry access.</summary>
11-
<h3>Configure Registry Access</h3>
12-
<p>
13-
Create a
14-
<a href="https://docs.github.com/en/packages/learn-github-packages/introduction-to-github-packages#authenticating-to-github-packages">token</a>
15-
with the <strong>read:packages</strong> scope<br/>
16-
17-
> Based on
18-
> <a href="https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-to-github-packages">GitHub documentation</a>,
19-
> In <em>Actions</em> you can use <em>GITHUB_TOKEN</em>
20-
</p>
21-
<p>
22-
23-
Add the following line to the <em>.npmrc</em> file in your user home (
24-
See [GH Docs](https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-npm-registry#authenticating-with-a-personal-access-token)):
25-
26-
```text
27-
//npm.pkg.github.com/:_authToken=<your-ghp-token-goes-here>
28-
```
29-
</p>
30-
</details>
31-
327
<h3>Usage</h3>
338
<p>
34-
Configuring <em>NPM</em> to look in <em>GHPR</em> for the <em>trustify-da</em> namespace is done by adding
35-
<code>@trustify-da:registry=https://npm.pkg.github.com</code> to <em>.npmrc</em> in the project root or user home.
36-
37-
```shell
38-
echo "@trustify-da:registry=https://npm.pkg.github.com" >> .npmrc
39-
echo "@trustification:registry=https://npm.pkg.github.com" >> .npmrc
40-
```
41-
</p>
429

4310
<ul>
4411
<li>

docker-image/Dockerfiles/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ FROM registry.access.redhat.com/ubi9/nodejs-20 AS builder
44
# use privilaged user
55
USER root
66

7-
# assign token for reading packages from github package registry
8-
ARG PACKAGE_REGISTRY_ACCESS_TOKEN=''
9-
ARG TRUSTIFY_DA_JAVASCRIPT_API_VERSION='0.1.1-ea.55'
7+
ARG TRUSTIFY_DA_JAVASCRIPT_API_VERSION='0.2.4-ea.12'
108

119
# install Java
1210
RUN curl -kL https://download.oracle.com/java/21/archive/jdk-21.0.1_linux-x64_bin.tar.gz -o /tmp/java-package.tar.gz \
@@ -23,10 +21,6 @@ RUN curl -kL https://go.dev/dl/go1.21.5.linux-amd64.tar.gz -o /tmp/golang-packag
2321
# install jq JSON formating tool
2422
RUN curl -kL https://github.com/jqlang/jq/releases/download/jq-1.7.1/jq-linux64 -o /usr/bin/jq
2523

26-
# copy the .npmrc file
27-
COPY configs/.npmrc .
28-
# replace placeholder with the actual environment variable
29-
RUN sed -i "s/__PACKAGE_REGISTRY_ACCESS_TOKEN__/${PACKAGE_REGISTRY_ACCESS_TOKEN}/g" ./.npmrc
3024
# install Exhort javascript API
3125
RUN npm install --global @trustify-da/trustify-da-javascript-client@${TRUSTIFY_DA_JAVASCRIPT_API_VERSION}
3226

docker-image/configs/.npmrc

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)