Skip to content

Commit

Permalink
Merge pull request #7 from opf/ci/npm-no-lockfiles
Browse files Browse the repository at this point in the history
fix: publish built Angular package instead of source dir
  • Loading branch information
b12f authored Jul 19, 2023
2 parents 61e3c91 + 360d82a commit cf40c9c
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/grumpy-garlics-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@openproject/octicons': patch
---

fix: publish built angular package instead of source
10 changes: 10 additions & 0 deletions .github/actions/build_angular/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM node:18-slim

RUN apt-get update && \
apt-get install --no-install-recommends -y \
jq && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/*

ADD entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
37 changes: 37 additions & 0 deletions .github/actions/build_angular/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash -l

set -e

printf "//registry.npmjs.org/:_authToken=%s" "$NPM_AUTH_TOKEN_SHARED" > "$HOME/.npmrc"

PACKAGE_VERSION=$(jq '.version' --raw-output ./package.json)

echo "************* Building v$PACKAGE_VERSION *************"

PUBLISH_TAG=latest
if [[ "$PACKAGE_VERSION" =~ ^0\.0\.0\- ]]
then
PUBLISH_TAG=canary
elif [[ "$PACKAGE_VERSION" =~ \-rc ]]
then
PUBLISH_TAG=next
fi

cd ./lib/$*

echo "**************** Copying assets files to build directory ****************"
cp -R ../build/ .

echo "**************** Installing ****************"
npm ci

echo "**************** Building ****************"
npm run build

{
echo "**************** Publishing ****************"
cd dist/octicons-angular && npm version --allow-same-version $PACKAGE_VERSION && npm publish --tag $PUBLISH_TAG --access public
} || {
# Bail out of publishing
exit 0
}
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:
with:
name: octicons
path: ./lib/build
- uses: ./.github/actions/build_node
- uses: ./.github/actions/build_angular
env:
NPM_AUTH_TOKEN_SHARED: ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
with:
Expand Down
1 change: 0 additions & 1 deletion lib/octicons_angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
"test": "echo 'No tests specified for @openproject/octicons-angular' && exit 0",
"watch": "script/build.js && ng build --watch --configuration development"
},
"private": false,
"peerDependencies": {
"@angular/common": "^16.1.0",
"@angular/compiler": "^16.1.0",
Expand Down

0 comments on commit cf40c9c

Please sign in to comment.