Skip to content

Commit a5673f4

Browse files
committed
feat: add npm publishing config and CI workflow for dev Docker builds
1 parent 4790c2c commit a5673f4

File tree

3 files changed

+102
-3
lines changed

3 files changed

+102
-3
lines changed
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build docker image for the dev environment
2+
3+
on:
4+
push:
5+
branches: [ "dev" ]
6+
tags: [ 'v*.*.*' ]
7+
workflow_dispatch:
8+
inputs:
9+
custom_branch:
10+
description: 'Branch to build the Docker image for.'
11+
required: false
12+
default: ''
13+
custom_tag:
14+
description: 'Tag for the Docker image (optional).'
15+
required: false
16+
default: ''
17+
18+
env:
19+
REGISTRY: ghcr.io
20+
IMAGE_NAME: ${{ github.repository }}
21+
22+
jobs:
23+
build:
24+
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
packages: write
29+
# This is used to complete the identity challenge
30+
# with sigstore/fulcio when running outside of PRs.
31+
id-token: write
32+
33+
steps:
34+
- name: Checkout repository
35+
uses: actions/checkout@v4
36+
37+
# Install the cosign tool
38+
# https://github.com/sigstore/cosign-installer
39+
- name: Install cosign
40+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
41+
with:
42+
cosign-release: 'v2.2.4'
43+
44+
# Set up BuildKit Docker container builder to be able to build
45+
# multi-platform images and export cache
46+
# https://github.com/docker/setup-buildx-action
47+
- name: Set up Docker Buildx
48+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
49+
50+
# Login against a Docker registry
51+
# https://github.com/docker/login-action
52+
- name: Log into registry ${{ env.REGISTRY }}
53+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
54+
with:
55+
registry: ${{ env.REGISTRY }}
56+
username: ${{ github.actor }}
57+
password: ${{ secrets.GITHUB_TOKEN }}
58+
59+
# Extract metadata (tags, labels) for Docker
60+
# https://github.com/docker/metadata-action
61+
- name: Extract Docker metadata
62+
id: meta
63+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
64+
with:
65+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
66+
67+
# Build and push Docker image with Buildx
68+
# https://github.com/docker/build-push-action
69+
- name: Build and push Docker image
70+
id: build-and-push
71+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
72+
with:
73+
context: .
74+
push: true
75+
tags: ${{ steps.meta.outputs.tags }}
76+
labels: ${{ steps.meta.outputs.labels }}
77+
cache-from: type=gha
78+
cache-to: type=gha,mode=max
79+
80+
# Sign the resulting Docker image digest.
81+
# This will only write to the public Rekor transparency log when the Docker
82+
# repository is public to avoid leaking data. If you would like to publish
83+
# transparency data even for private images, pass --force to cosign below.
84+
# https://github.com/sigstore/cosign
85+
- name: Sign the published Docker image
86+
env:
87+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
88+
TAGS: ${{ steps.meta.outputs.tags }}
89+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
90+
# This step uses the identity token to provision an ephemeral certificate
91+
# against the sigstore community Fulcio instance.
92+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@emp74ark:registry=https://npm.pkg.github.com

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
{
2-
"name": "rss-angular",
3-
"version": "0.0.0",
2+
"name": "@emp74ark/rss-angular",
3+
"version": "0.0.1",
4+
"description": "Frontend for RSS Feeds client",
5+
"author": "emp74ark",
6+
"private": true,
7+
"license": "ISC",
8+
"publishConfig": {
9+
"@emp74ark:registry": "https://npm.pkg.github.com"
10+
},
411
"scripts": {
512
"ng": "ng",
613
"start": "ng serve",
714
"build": "ng build",
815
"watch": "ng build --watch --configuration development",
916
"test": "ng test"
1017
},
11-
"private": true,
1218
"dependencies": {
1319
"@angular/cdk": "~20.0.3",
1420
"@angular/common": "^20.0.0",

0 commit comments

Comments
 (0)