-
Notifications
You must be signed in to change notification settings - Fork 472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIO-7507: Publish dev tag to npm #1060
Merged
Merged
Changes from 28 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
2efb983
init test
ryanformio fab3493
Run publish
ryanformio 59c1672
View unclean directory
ryanformio 8098c84
Adding --no-git-tag-version to npm version
ryanformio eadad3a
Forgot to uncomment
ryanformio 2e45ec8
Not sure how these got backwards
ryanformio edbc24e
Seems the reason is due to the existence of publish in package.json
ryanformio 4598086
Add run
ryanformio e2d3f52
restore build cache and run publish
ryanformio b2f21b7
Change directory where git user and npmrc occur
ryanformio 72ce0cd
test
ryanformio 0378d72
Publish Dry run
ryanformio 7fccf00
View git status for unclean directory
ryanformio 8c9f7fd
Navigate to the dir and publish
ryanformio 3c232c0
Moves the npm token around
ryanformio 3b0b971
Getting unclean dir
ryanformio 8de3677
try adding .npmrc to ignore
ryanformio f7c9795
Adds --no-git-tag-version so will by pass the modifications to .npmrc
ryanformio 48ab78d
Try from cache again
ryanformio b272e25
seems like it will fail without no-git-tag but still push
ryanformio f6448ba
Its not publishing from the correct directory it seems
ryanformio e61e78c
directory test
ryanformio 59f26ea
Having issues getting it to deploy to correct directory
ryanformio f605790
switch dirs before creating tag
ryanformio daa6205
Adds working directory to steps
ryanformio 57ea833
Last minute clean-up
ryanformio dd7e31e
Merge branch 'master' into FIO-7507-publish-dev-tag-to-npm
ryanformio e62b35a
Updates with 7848 and uses yarn publish
ryanformio 8982fec
Updates for FIO-8237, and addresses PR comments in formioreport.compo…
ryanformio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,219 @@ | ||
name: Build, Publish | ||
|
||
on: | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
env: | ||
NODE_VERSION: 20.x | ||
|
||
jobs: | ||
##################################################################### | ||
## Setup | ||
##################################################################### | ||
setup: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: echo "Triggered by ${{ github.event_name }} event." | ||
|
||
- name: Check out repository code ${{ github.repository }} on ${{ github.ref }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: 'npm' | ||
|
||
- name: Cache node modules | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
|
||
- name: Installing dependencies | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
uses: borales/actions-yarn@v4 | ||
with: | ||
cmd: install --frozen-lockfile | ||
|
||
# - name: Lint | ||
# uses: borales/actions-yarn@v4 | ||
# with: | ||
# cmd: lint | ||
|
||
##################################################################### | ||
## Build | ||
##################################################################### | ||
build: | ||
needs: setup | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code ${{ github.repository }} on ${{ github.ref }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Restore node modules from cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: node_modules | ||
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-node- | ||
|
||
- name: Build | ||
uses: borales/actions-yarn@v4 | ||
with: | ||
cmd: build:prod | ||
|
||
- name: Show build directory contents | ||
run: | | ||
ls -R ./dist/angular-formio | ||
|
||
- name: Cache dist directory | ||
uses: actions/cache@v3 | ||
with: | ||
path: dist | ||
key: ${{ runner.os }}-dist-${{ hashFiles('dist.tgz') }} | ||
restore-keys: | | ||
${{ runner.os }}-dist- | ||
|
||
##################################################################### | ||
## Test (Trys to launch a chrome browser, will need additional work) | ||
##################################################################### | ||
# test-current: | ||
# needs: setup | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} | ||
# uses: actions/checkout@v3 | ||
|
||
# - name: Restore node modules from cache | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: node_modules | ||
# key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-node- | ||
|
||
# - name: Test | ||
# uses: borales/actions-yarn@v4 | ||
# with: | ||
# cmd: test | ||
|
||
# test-target: | ||
# needs: setup | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Check out repository code ${{ github.repository }} on ${{ github.ref }} | ||
# uses: actions/checkout@v3 | ||
# with: | ||
# fetch-depth: 0 | ||
|
||
# - name: Merge target branch into current branch | ||
# run: | | ||
# git config --global user.email "[email protected]" | ||
# git config --global user.name "pkgbot" | ||
# git fetch origin ${{ github.event.pull_request.base.ref }}:${{ github.event.pull_request.base.ref }} | ||
# git merge ${{ github.event.pull_request.base.ref }} --no-commit --no-ff | ||
# if ! git merge --no-commit --no-ff ${{ github.event.pull_request.base.ref }}; then | ||
# echo "Merge conflicts detected." | ||
# git merge --abort | ||
# exit 1 | ||
# else | ||
# echo "Merge successful." | ||
# fi | ||
|
||
# - name: Set up Node.js ${{ env.NODE_VERSION }} | ||
# uses: actions/setup-node@v3 | ||
# with: | ||
# node-version: ${{ env.NODE_VERSION }} | ||
# cache: 'npm' | ||
|
||
# - name: Restore node modules from cache | ||
# uses: actions/cache@v3 | ||
# with: | ||
# path: node_modules | ||
# key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-node- | ||
|
||
# - name: Test | ||
# uses: borales/actions-yarn@v4 | ||
# with: | ||
# cmd: test | ||
|
||
##################################################################### | ||
## Publish | ||
##################################################################### | ||
publish: | ||
needs: [setup, build] | ||
if: ${{ github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'synchronize') }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository code ${{ github.repository }} on ${{ github.ref }} | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js ${{ env.NODE_VERSION }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ env.NODE_VERSION }} | ||
cache: 'npm' | ||
registry-url: 'https://registry.npmjs.org/' | ||
|
||
# Restore Build cache | ||
- name: Restore dist cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: dist | ||
key: ${{ runner.os }}-dist-${{ hashFiles('dist.tgz') }} | ||
restore-keys: | | ||
${{ runner.os }}-dist- | ||
|
||
# - name: Switch to dist directory | ||
# run: | | ||
# cd ./dist/angular-formio | ||
# ls -R . | ||
|
||
- name: Prepare version for publish | ||
id: prep | ||
working-directory: ./dist/angular-formio | ||
run: | | ||
# Extract the pull request number and the short SHA of the commit | ||
PR_NUMBER=$(echo ${{ github.event.number }}) | ||
COMMIT_SHORT_SHA=$(echo "${{ github.event.pull_request.head.sha }}" | cut -c1-7) | ||
|
||
# Extract the current version from package.json | ||
CURRENT_VERSION=$(node -p "require('./package.json').version") | ||
|
||
# Get base SemVer to us for new dev version | ||
BASE_VERSION=$(echo "$CURRENT_VERSION" | cut -d'-' -f1) | ||
|
||
# Construct the new version string | ||
NEW_VERSION="${BASE_VERSION}-dev.${PR_NUMBER}.${COMMIT_SHORT_SHA}" | ||
|
||
# Output the new version for use in subsequent GitHub Actions steps | ||
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_ENV | ||
|
||
- name: Echo version to Publish | ||
run: | | ||
echo "Version to publish: $NEW_VERSION" | ||
|
||
- name: Configure Git user | ||
working-directory: ./dist/angular-formio | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "pkgbot" | ||
|
||
- name: Add npm token to .npmrc | ||
working-directory: ./dist/angular-formio | ||
run: | | ||
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc | ||
|
||
- name: Publish to npm | ||
working-directory: ./dist/angular-formio | ||
run: | | ||
npm version $NEW_VERSION | ||
yarn publish --tag=dev | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,3 +47,5 @@ testem.log | |
# System Files | ||
.DS_Store | ||
Thumbs.db | ||
|
||
.npmrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,3 +32,5 @@ Desktop.ini | |
# Library files | ||
src/* | ||
build/* | ||
|
||
.npmrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not so certain about this change in the context of this ticket - I gather this causes a TypeScript error? If that's the case, how does this build ever succeed? This library is routinely built and published in our build pipelines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overlooked before committing. Retested, looks like it is possibly redundant and can be removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my issue is that "possibly redundant" is not enough evidence for me to clobber a class instance variable in a PR that is just trying to publish a dev tag to npm. If we're not absolutely certain, let's check with the author of the code (Tanya?), who may say "you can just add an initializer to the class" or "sure go ahead it's not necessary"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FormioReportComponent
extendsFormioComponent
which extendsFormioBaseComponent
which includes an isLoading property already, which I believe it where our redundancy is coming from.FormioReportComponent (causes redundant error)
angular/projects/angular-formio/src/components/formioreport/formioreport.component.ts
Line 20 in 4eee5a6
FormioBaseComponent
angular/projects/angular-formio/src/FormioBaseComponent.ts
Line 71 in 9d4eb9e
When running
yarn build
on commit where redundancy was added