Skip to content

Commit a56ae31

Browse files
committed
perms
1 parent d907a22 commit a56ae31

File tree

3 files changed

+4
-315
lines changed

3 files changed

+4
-315
lines changed

.github/workflows/release-alternative.yml

Lines changed: 1 addition & 138 deletions
Original file line numberDiff line numberDiff line change
@@ -119,141 +119,4 @@ jobs:
119119
dist/proofofaccess-*
120120
!dist/*.tar.gz
121121
!dist/*.zip
122-
retention-days: 7
123-
124-
publish-npm:
125-
needs: build-and-release
126-
runs-on: ubuntu-latest
127-
steps:
128-
- name: Setup Node.js
129-
uses: actions/setup-node@v4
130-
with:
131-
node-version: '18'
132-
registry-url: 'https://registry.npmjs.org'
133-
134-
- name: Download binaries
135-
uses: actions/download-artifact@v4
136-
with:
137-
name: proofofaccess-binaries
138-
path: npm-binaries
139-
140-
- name: Create NPM package
141-
run: |
142-
VERSION="${{ needs.build-and-release.outputs.version }}"
143-
144-
# Create package structure
145-
mkdir -p npm-package/bin
146-
cp npm-binaries/* npm-package/bin/ || true
147-
148-
# Create package.json
149-
cat > npm-package/package.json << EOF
150-
{
151-
"name": "@disregardfiat/proofofaccess",
152-
"version": "${VERSION}",
153-
"description": "ProofOfAccess binary for SPK Network storage validation",
154-
"main": "index.js",
155-
"bin": {
156-
"proofofaccess": "./install.js"
157-
},
158-
"scripts": {
159-
"postinstall": "node install.js"
160-
},
161-
"keywords": ["spk", "proofofaccess", "storage", "validation", "ipfs"],
162-
"author": "SPK Network",
163-
"license": "MIT",
164-
"repository": {
165-
"type": "git",
166-
"url": "https://github.com/spknetwork/proofofaccess.git"
167-
},
168-
"files": [
169-
"index.js",
170-
"install.js",
171-
"bin/**/*"
172-
],
173-
"os": ["darwin", "linux", "win32"],
174-
"cpu": ["x64", "arm64"]
175-
}
176-
EOF
177-
178-
# Create index.js
179-
cat > npm-package/index.js << 'EOF'
180-
const path = require('path');
181-
const os = require('os');
182-
const fs = require('fs');
183-
184-
function getBinaryName() {
185-
const platform = os.platform();
186-
const arch = os.arch();
187-
188-
let platformName = platform === 'darwin' ? 'darwin' :
189-
platform === 'win32' ? 'windows' : 'linux';
190-
let archName = arch === 'x64' ? 'amd64' : 'arm64';
191-
192-
const ext = platform === 'win32' ? '.exe' : '';
193-
return `proofofaccess-${platformName}-${archName}${ext}`;
194-
}
195-
196-
function getBinaryPath() {
197-
const binaryName = getBinaryName();
198-
const binPath = path.join(__dirname, 'bin', binaryName);
199-
200-
if (!fs.existsSync(binPath)) {
201-
throw new Error(`Binary not found: ${binPath}`);
202-
}
203-
204-
return binPath;
205-
}
206-
207-
module.exports = {
208-
path: getBinaryPath(),
209-
getBinaryPath,
210-
getBinaryName
211-
};
212-
EOF
213-
214-
# Create install.js
215-
cat > npm-package/install.js << 'EOF'
216-
#!/usr/bin/env node
217-
const fs = require('fs');
218-
const path = require('path');
219-
const { getBinaryPath } = require('./index');
220-
221-
if (require.main === module) {
222-
const { spawn } = require('child_process');
223-
try {
224-
const binaryPath = getBinaryPath();
225-
const proc = spawn(binaryPath, process.argv.slice(2), {
226-
stdio: 'inherit'
227-
});
228-
229-
proc.on('exit', (code) => {
230-
process.exit(code);
231-
});
232-
} catch (error) {
233-
console.error('Error:', error.message);
234-
process.exit(1);
235-
}
236-
} else {
237-
try {
238-
const binaryPath = getBinaryPath();
239-
240-
if (process.platform !== 'win32') {
241-
fs.chmodSync(binaryPath, 0o755);
242-
}
243-
244-
console.log(`ProofOfAccess binary installed: ${binaryPath}`);
245-
} catch (error) {
246-
console.error('Warning: Could not find binary for your platform');
247-
console.error(error.message);
248-
}
249-
}
250-
EOF
251-
252-
chmod +x npm-package/install.js
253-
254-
- name: Publish to NPM
255-
env:
256-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
257-
working-directory: npm-package
258-
run: |
259-
npm publish --access public
122+
retention-days: 7

.github/workflows/release.yml

Lines changed: 1 addition & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -131,180 +131,4 @@ jobs:
131131
with:
132132
name: proofofaccess-binaries
133133
path: dist/
134-
retention-days: 7
135-
136-
publish-npm:
137-
needs: build-and-release
138-
runs-on: ubuntu-latest
139-
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
140-
steps:
141-
- name: Checkout code
142-
uses: actions/checkout@v4
143-
144-
- name: Setup Node.js
145-
uses: actions/setup-node@v4
146-
with:
147-
node-version: '18'
148-
registry-url: 'https://registry.npmjs.org'
149-
150-
- name: Download artifacts from workflow
151-
uses: actions/download-artifact@v4
152-
with:
153-
name: proofofaccess-binaries
154-
path: npm-binaries
155-
156-
- name: List downloaded binaries
157-
run: |
158-
echo "Downloaded binaries:"
159-
ls -la npm-binaries/
160-
161-
- name: Create NPM package
162-
run: |
163-
# Create package directory
164-
mkdir -p npm-package/bin
165-
166-
# Copy binaries to npm package
167-
cp -r npm-binaries/* npm-package/bin/
168-
169-
# Create package.json
170-
VERSION="${{ needs.build-and-release.outputs.version }}"
171-
if [ -z "$VERSION" ]; then
172-
VERSION=$(gh release view --json tagName -q '.tagName' | sed 's/^v//')
173-
fi
174-
175-
cat > npm-package/package.json << EOF
176-
{
177-
"name": "@disregardfiat/proofofaccess",
178-
"version": "${VERSION}",
179-
"description": "ProofOfAccess binary for SPK Network storage validation",
180-
"main": "index.js",
181-
"bin": {
182-
"proofofaccess": "./install.js"
183-
},
184-
"scripts": {
185-
"postinstall": "node install.js"
186-
},
187-
"keywords": ["spk", "proofofaccess", "storage", "validation", "ipfs"],
188-
"author": "SPK Network",
189-
"license": "MIT",
190-
"repository": {
191-
"type": "git",
192-
"url": "https://github.com/spknetwork/proofofaccess.git"
193-
},
194-
"files": [
195-
"index.js",
196-
"install.js",
197-
"bin/**/*"
198-
],
199-
"os": ["darwin", "linux", "win32"],
200-
"cpu": ["x64", "arm64"]
201-
}
202-
EOF
203-
204-
# Create index.js
205-
cat > npm-package/index.js << 'EOF'
206-
const path = require('path');
207-
const os = require('os');
208-
const fs = require('fs');
209-
210-
function getBinaryName() {
211-
const platform = os.platform();
212-
const arch = os.arch();
213-
214-
let platformName;
215-
switch (platform) {
216-
case 'darwin':
217-
platformName = 'darwin';
218-
break;
219-
case 'win32':
220-
platformName = 'windows';
221-
break;
222-
case 'linux':
223-
platformName = 'linux';
224-
break;
225-
default:
226-
throw new Error(`Unsupported platform: ${platform}`);
227-
}
228-
229-
let archName;
230-
switch (arch) {
231-
case 'x64':
232-
archName = 'amd64';
233-
break;
234-
case 'arm64':
235-
archName = 'arm64';
236-
break;
237-
default:
238-
throw new Error(`Unsupported architecture: ${arch}`);
239-
}
240-
241-
const ext = platform === 'win32' ? '.exe' : '';
242-
return `proofofaccess-${platformName}-${archName}${ext}`;
243-
}
244-
245-
function getBinaryPath() {
246-
const binaryName = getBinaryName();
247-
const binPath = path.join(__dirname, 'bin', binaryName);
248-
249-
if (!fs.existsSync(binPath)) {
250-
throw new Error(`Binary not found: ${binPath}`);
251-
}
252-
253-
return binPath;
254-
}
255-
256-
module.exports = {
257-
path: getBinaryPath(),
258-
getBinaryPath,
259-
getBinaryName
260-
};
261-
EOF
262-
263-
# Create install.js
264-
cat > npm-package/install.js << 'EOF'
265-
#!/usr/bin/env node
266-
const fs = require('fs');
267-
const path = require('path');
268-
const { getBinaryPath } = require('./index');
269-
270-
// If called directly, execute the binary
271-
if (require.main === module) {
272-
const { spawn } = require('child_process');
273-
try {
274-
const binaryPath = getBinaryPath();
275-
const proc = spawn(binaryPath, process.argv.slice(2), {
276-
stdio: 'inherit'
277-
});
278-
279-
proc.on('exit', (code) => {
280-
process.exit(code);
281-
});
282-
} catch (error) {
283-
console.error('Error:', error.message);
284-
process.exit(1);
285-
}
286-
} else {
287-
// Postinstall: make binary executable
288-
try {
289-
const binaryPath = getBinaryPath();
290-
291-
if (process.platform !== 'win32') {
292-
fs.chmodSync(binaryPath, 0o755);
293-
}
294-
295-
console.log(`ProofOfAccess binary installed: ${binaryPath}`);
296-
} catch (error) {
297-
console.error('Warning: Could not find binary for your platform');
298-
console.error(error.message);
299-
}
300-
}
301-
EOF
302-
303-
chmod +x npm-package/install.js
304-
305-
- name: Publish to NPM
306-
env:
307-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
308-
working-directory: npm-package
309-
run: |
310-
npm publish --access public
134+
retention-days: 7

logs/security/.security-key

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
o�kB�
2+
���#�l3��'O+f]�:�5@�Ƕ=>A�

0 commit comments

Comments
 (0)