Skip to content

Commit 6c85deb

Browse files
committed
[Chore] Fixed OpenUpm publish pipeline error of version 0.1.1
1 parent 22b0a7d commit 6c85deb

File tree

6 files changed

+308
-35
lines changed

6 files changed

+308
-35
lines changed

.github/scripts/functions.sh

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -75,24 +75,10 @@ githubActionsOutputs() {
7575
# copyPackagesContent
7676
# # result: Copy "Packages/<PACKAGE_NAME>/*.*" to ROOT/
7777
copyPackagesContent() {
78-
#shopt -s extglob dotglob
79-
80-
# Preserve .env file from $PKG_ROOT
81-
# if [ -f "$PKG_ROOT/.env"]
82-
# then
83-
# mkdir "$PKG_ROOT/tmp"
84-
# mv "$PKG_ROOT/.env" "$PKG_ROOT/tmp"
85-
# fi
78+
shopt -s extglob dotglob
8679

8780
cp -rvf "Packages/$PKG_NAME/." "$PKG_ROOT/"
8881
rm -rf ./Packages
89-
90-
# Move .env to $PKG_ROOT
91-
# if [ -f "$PKG_ROOT/tmp/.env"]
92-
# then
93-
# mv -f "$PKG_ROOT/tmp/.env" "$PKG_ROOT/"
94-
# rm -rf "$PKG_ROOT/tmp"
95-
# fi
9682
}
9783

9884
# TODO: Move this common function to another script file in order to reuse (e.g .github/scripts/common.sh)
@@ -137,6 +123,7 @@ renameInvalidDirs() {
137123
#
138124
# @see $PKG_BRANCH
139125
# @see renameInvalidDirs()
126+
# @see fixEnvFile()
140127
commitAndPush() {
141128
# Incrementing LAST_RELEASE_TAG+1.
142129
# Keep here just to store the history, and if need this to the future/others repositories
@@ -180,22 +167,21 @@ commitAndPush() {
180167
copyFilesForPublish() {
181168
local repository_root=$1
182169

170+
# $PKG_ROOT environment variable check
171+
checkPkgRoot $2
172+
local pkg_root_full_path=$(realpath $PKG_ROOT)
173+
183174
if [ -z "$repository_root" ]
184175
then
185-
echo "[COPY FILES] The parameter \$1 => \$repository_root is required: $repository_root"
176+
echo "[COPY FILES] The parameter \$1 => \$repository_root is required: '$repository_root'"
186177
return 1
187178
else
188179
if [[ "$repository_root" =~ \.$ ]]
189180
then
190181
repository_root="$repository_root/"
191182
fi
192-
echo "[COPY FILES] \$repository_root: $repository_root"
193183
fi
194184

195-
# $PKG_ROOT environment variable check
196-
checkPkgRoot $2
197-
198-
local pkg_root_full_path=$(realpath $PKG_ROOT)
199185
if [[ $repository_root == $pkg_root_full_path ]]
200186
then
201187
echo "[COPY FILES] Cannot copy a directory FROM: \$repository_root => '$repository_root' to \$PKG_ROOT => '$pkg_root_full_path', into itself"
@@ -204,6 +190,8 @@ copyFilesForPublish() {
204190

205191
chmod -R 777 "$PKG_ROOT/"
206192

193+
echo "[COPY FILES] From \$repository_root: '$(realpath $repository_root)', to => \$PKG_ROOT: '$pkg_root_full_path'"
194+
207195
local files_copy=(README.md README.md.meta LICENSE LICENSE.meta Images Images.meta)
208196
for file_name in "${files_copy[@]}"
209197
do
@@ -225,21 +213,45 @@ copyFilesForPublish() {
225213
# @arg $2 string A path configured as "$PKG_ROOT" environment variable to be used as
226214
# root path of the package
227215
#
216+
# @arg $3 string A flag configured as "$PUBLISH_FORCE" environment variable to force
217+
# publish from "./" root path (usually when publishing packages from a local repo)
218+
#
228219
# @see $PKG_ROOT
220+
# @see $PUBLISH_FORCE
229221
# @see renameInvalidDirs($PKG_ROOT)
230222
# @see copyFilesForPublish($1)
223+
# @see [Using Boolean Variables in Shell Scripts](https://tecadmin.net/boolean-variable-in-shell-script)
231224
localBeforePublish() {
232225
local repository_root=$1
226+
local publish_forced='false'
227+
228+
# Check if publish "force" is true
229+
if [ -z "$PUBLISH_FORCE" ]
230+
then
231+
PUBLISH_FORCE=$3
232+
if [ -z "$PUBLISH_FORCE" ]
233+
then
234+
PUBLISH_FORCE=0
235+
fi
236+
fi
233237

234-
if [ -d $repository_root ] && [[ $repository_root != "./" && $repository_root != "." ]]
238+
if [ $PUBLISH_FORCE -eq 1 ]
235239
then
240+
publish_forced='true'
241+
fi
242+
243+
if [ -d $repository_root ] && [[ $repository_root != "./" && $repository_root != "." || $PUBLISH_FORCE -eq 1 ]]
244+
then
245+
246+
echo "[PUBLISH: BEFORE/PRE] Forced => '$publish_forced'"
247+
236248
# $PKG_ROOT environment variable check
237249
checkPkgRoot $2
238250

239251
renameInvalidDirs $PKG_ROOT
240252
copyFilesForPublish $repository_root
241253
else
242-
echo "[PRE PUBLISH] [Skip] Bypass package preparation because \$1 : \$repository_root => '$repository_root' is invalid"
254+
echo "[PUBLISH: BEFORE/PRE] [Skip] Bypass package preparation because \$1 : \$repository_root => '$repository_root' is invalid"
243255
fi
244256
}
245257

@@ -255,7 +267,7 @@ localPublish() {
255267
checkPkgRoot $1
256268

257269
cd $PKG_ROOT
258-
npm publish
270+
npm run package:prepare && npm publish
259271
}
260272

261273
run() {

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"terminal.integrated.defaultProfile.windows": "Git Bash",
3+
"dotnet.preferCSharpExtension": true,
4+
"dotnetAcquisitionExtension.enableTelemetry": false,
35
"files.associations": {
46
"*.jspre": "javascript",
57
"*.jslib": "javascript"

Packages/com.benoitfreslon.vibration/.gitignore

Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,223 @@ crashlytics-build.properties
7070
# Temporary auto-generated Android Assets
7171
/[Aa]ssets/[Ss]treamingAssets/aa.meta
7272
/[Aa]ssets/[Ss]treamingAssets/aa/*
73+
74+
# ---------------------
75+
# Global/JetBrains.gitignore
76+
# ---------------------
77+
78+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
79+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
80+
81+
# User-specific stuff
82+
.idea/**/workspace.xml
83+
.idea/**/tasks.xml
84+
.idea/**/usage.statistics.xml
85+
.idea/**/dictionaries
86+
.idea/**/shelf
87+
88+
# AWS User-specific
89+
.idea/**/aws.xml
90+
91+
# Generated files
92+
.idea/**/contentModel.xml
93+
94+
# Sensitive or high-churn files
95+
.idea/**/dataSources/
96+
.idea/**/dataSources.ids
97+
.idea/**/dataSources.local.xml
98+
.idea/**/sqlDataSources.xml
99+
.idea/**/dynamic.xml
100+
.idea/**/uiDesigner.xml
101+
.idea/**/dbnavigator.xml
102+
103+
# Gradle
104+
.idea/**/gradle.xml
105+
.idea/**/libraries
106+
107+
# Gradle and Maven with auto-import
108+
# When using Gradle or Maven with auto-import, you should exclude module files,
109+
# since they will be recreated, and may cause churn. Uncomment if using
110+
# auto-import.
111+
# .idea/artifacts
112+
# .idea/compiler.xml
113+
# .idea/jarRepositories.xml
114+
# .idea/modules.xml
115+
# .idea/*.iml
116+
# .idea/modules
117+
# *.iml
118+
# *.ipr
119+
120+
# CMake
121+
cmake-build-*/
122+
123+
# Mongo Explorer plugin
124+
.idea/**/mongoSettings.xml
125+
126+
# File-based project format
127+
*.iws
128+
129+
# IntelliJ
130+
out/
131+
132+
# mpeltonen/sbt-idea plugin
133+
.idea_modules/
134+
135+
# JIRA plugin
136+
atlassian-ide-plugin.xml
137+
138+
# Cursive Clojure plugin
139+
.idea/replstate.xml
140+
141+
# SonarLint plugin
142+
.idea/sonarlint/
143+
144+
# Crashlytics plugin (for Android Studio and IntelliJ)
145+
com_crashlytics_export_strings.xml
146+
crashlytics.properties
147+
crashlytics-build.properties
148+
fabric.properties
149+
150+
# Editor-based Rest Client
151+
.idea/httpRequests
152+
153+
# Android studio 3.1+ serialized cache file
154+
.idea/caches/build_file_checksums.ser
155+
156+
# ---------------------
157+
# Node.gitignore
158+
# ---------------------
159+
160+
# Logs
161+
logs
162+
*.log
163+
npm-debug.log*
164+
yarn-debug.log*
165+
yarn-error.log*
166+
lerna-debug.log*
167+
.pnpm-debug.log*
168+
169+
# Diagnostic reports (https://nodejs.org/api/report.html)
170+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
171+
172+
# Runtime data
173+
pids
174+
*.pid
175+
*.seed
176+
*.pid.lock
177+
178+
# Directory for instrumented libs generated by jscoverage/JSCover
179+
lib-cov
180+
181+
# Coverage directory used by tools like istanbul
182+
coverage
183+
*.lcov
184+
185+
# nyc test coverage
186+
.nyc_output
187+
188+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
189+
.grunt
190+
191+
# Bower dependency directory (https://bower.io/)
192+
bower_components
193+
194+
# node-waf configuration
195+
.lock-wscript
196+
197+
# Compiled binary addons (https://nodejs.org/api/addons.html)
198+
build/Release
199+
200+
# Dependency directories
201+
node_modules/
202+
jspm_packages/
203+
204+
# Snowpack dependency directory (https://snowpack.dev/)
205+
web_modules/
206+
207+
# TypeScript cache
208+
*.tsbuildinfo
209+
210+
# Optional npm cache directory
211+
.npm
212+
213+
# Optional eslint cache
214+
.eslintcache
215+
216+
# Optional stylelint cache
217+
.stylelintcache
218+
219+
# Microbundle cache
220+
.rpt2_cache/
221+
.rts2_cache_cjs/
222+
.rts2_cache_es/
223+
.rts2_cache_umd/
224+
225+
# Optional REPL history
226+
.node_repl_history
227+
228+
# Output of 'npm pack'
229+
*.tgz
230+
231+
# Yarn Integrity file
232+
.yarn-integrity
233+
234+
# dotenv environment variable files
235+
# Used as ".env.defaults" and commited to repository)
236+
# use the others files below to store local only values,
237+
# such as: tokens, credentials...
238+
# .env
239+
.env.development.local
240+
.env.test.local
241+
.env.production.local
242+
.env.local
243+
244+
# parcel-bundler cache (https://parceljs.org/)
245+
.cache
246+
.parcel-cache
247+
248+
# Next.js build output
249+
.next
250+
out
251+
252+
# Nuxt.js build / generate output
253+
.nuxt
254+
dist
255+
256+
# Gatsby files
257+
.cache/
258+
# Comment in the public line in if your project uses Gatsby and not Next.js
259+
# https://nextjs.org/blog/next-9-1#public-directory-support
260+
# public
261+
262+
# vuepress build output
263+
.vuepress/dist
264+
265+
# vuepress v2.x temp and cache directory
266+
.temp
267+
.cache
268+
269+
# Docusaurus cache and generated files
270+
.docusaurus
271+
272+
# Serverless directories
273+
.serverless/
274+
275+
# FuseBox cache
276+
.fusebox/
277+
278+
# DynamoDB Local files
279+
.dynamodb/
280+
281+
# TernJS port file
282+
.tern-port
283+
284+
# Stores VSCode versions used for testing VSCode extensions
285+
.vscode-test
286+
287+
# yarn v2
288+
.yarn/cache
289+
.yarn/unplugged
290+
.yarn/build-state.yml
291+
.yarn/install-state.gz
292+
.pnp.*

Packages/com.benoitfreslon.vibration/package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,19 @@
44
"displayName": "Vibration",
55
"description": "Native free plugin for Unity for Android, iOS and WebGL. Use custom vibrations/haptics on mobile.",
66
"unity": "2019.3",
7-
"version": "0.1.1",
7+
"version": "0.1.3",
88
"keywords": [],
99
"devDependencies": {
1010
"cross-var": "^1.1.0",
1111
"dotenv-cli": "^7.3.0"
1212
},
1313
"scripts": {
14-
"prepublishOnly": "dotenv cross-var \"bash $REPOSITORY_ROOT/.github/scripts/functions.sh localBeforePublish $REPOSITORY_ROOT\"",
1514
"package:rename-dirs": "dotenv cross-var \"bash $REPOSITORY_ROOT/.github/scripts/functions.sh renameInvalidDirs .\"",
16-
"package:copy-files": "dotenv cross-var \"bash $REPOSITORY_ROOT/.github/scripts/functions.sh copyFilesForPublish .\""
15+
"package:copy-files": "dotenv cross-var \"bash $REPOSITORY_ROOT/.github/scripts/functions.sh copyFilesForPublish .\"",
16+
"package:prepare": "dotenv cross-var \"bash $REPOSITORY_ROOT/.github/scripts/functions.sh localBeforePublish $REPOSITORY_ROOT\"",
17+
"package:pack": "npm run package:prepare && npm pack",
18+
"package:publish-from-local": "dotenv -v PUBLISH_FORCE=1 npm run package:prepare && npm publish",
19+
"publish:from-local": "npm run package:publish-from-local"
1720
},
1821
"repository": {
1922
"type": "git",

0 commit comments

Comments
 (0)