Here is the error log message:
[3:40:55 PM] [semantic-release] › ✖ The command "git push --dry-run
--no-verify https://gitlab-ci-token:[secure]#[repository-url].git
HEAD:main" failed with the error message remote: You are not allowed
to upload code.
fatal: unable to access 'https://gitlab-ci-token:[secure]#[repository-url]/': The requested URL returned error: 403.
I have a GITLAB_TOKEN set up in the repository settings with all the necessary permissions, but it seems it isn't even being used:
Here is my .releaserc.json config:
{
"branches": ["main", { "name": "beta", "prerelease": true }],
"plugins": [
"#semantic-release/commit-analyzer",
"#semantic-release/release-notes-generator",
"#semantic-release/changelog",
"#semantic-release/npm",
"#semantic-release/gitlab",
[
"#semantic-release/git",
{
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
}
]
]
}
Here it's my .gitlab-ci.yml config:
# NodeJs image
image: node:16
# STAGES
stages:
- checks
- build
- release
# SETUP
before_script:
- node -v
- npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
- npm ci --cache .npm --prefer-offline
# JOBS
lint:
stage: checks
script:
- npm run lint
test:
stage: checks
script:
- npm run test:ci
build:
stage: build
script:
- npm run build
release:
stage: release
only:
- main
script:
- npx semantic-release
And here are the semantic release dependencies I'm using and it's versions:
"#semantic-release/changelog": "^6.0.1",
"#semantic-release/git": "^10.0.1",
"#semantic-release/gitlab": "^7.0.4",
"#semantic-release": "^19.0.2",
The GITLAB_TOKEN is a member of the repository as a maintainer (just like the other repositories where semantic release is working):
Any suggestions?
So in the end the problem was that I had to add the created GITLAB_TOKEN access token in Settings > CI/CD > Variables
Related
hi geeks I am trying to deploy my website through Github pages
so I saw this video that shows me how to deploy the Nextjs website to Github pages.
https://www.youtube.com/watch?v=dalXCXCIPHM
but the build was failed with this error
Failed to compile.
./node_modules/#splinetool/react-spline/dist/react-spline.es.js
Module not found: Can't resolve '#splinetool/runtime' in '/home/runner/work/abdallahzaher2022/abdallahzaher2022/node_modules/#splinetool/react-spline/dist'
Import trace for requested module:
./node_modules/#splinetool/react-spline/dist/react-spline.es.js
./components/WelcomeComp.tsx
> Build failed because of webpack errors
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! abdallahzaher#0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the abdallahzaher#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-11-24T15_13_56_537Z-debug.log
Error: Process completed with exit code 1.
so I found that problem is with the spline 3d model
I hope there is a solution because the npm run build runs successfully
this is some of my changes that i think it is related
next.config.js
/** #type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
swcMinify: true,
images: {
loader: "akamai",
path: " ",
},
};
module.exports = nextConfig;
package.json
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint",
"export": "next export"
},
and finally this is the workflow file in nodejs config in github pages
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
name: Node.js CI
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout#v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run build
- run: npm run export
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action#v4
with:
folder: out # The folder the action should deploy.
Not sure if you've already solved it, but here we go:
So, to debug this, the following information would be required:
Is it deploying correctly on Vercel?
The image 'akamai' loader is usually not required if you deploy on Vercel since they optimize much stuff behind the scenes.
A complete package.json
Suggestion: Use the default Next.js workflow configuration provided by GitHub Pages and see if the error vanishes.
Finally, here's one of my Next.js websites where I've used Spline extensively.
Feel free to use components/SplineObj.js as a template.
GitHub Actions Build fails for the Nextjs, I have the following GitHub workflow File :
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout#v3
- name: Install NodeJS
uses: actions/setup-node#v3
with:
node-version: '16.16.0'
- uses: actions/checkout#v3
- uses: borales/actions-yarn#v3.0.0
with:
cmd: install # will run `yarn install` command
- uses: borales/actions-yarn#v3.0.0
name: lint React App
with:
cmd: lint # will run `yarn run lint` command
- uses: borales/actions-yarn#v3.0.0
name: Build React App
with:
cmd: build # will run `yarn build` command
I have changed the Nodejs version to 16.16.0 but even then it continuously giving
node:internal/crypto/hash:71
this[kHandle] = new _Hash(algorithm, xofLen);
^
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:71:19)
at Object.createHash (node:crypto:133:10)
at BulkUpdateDecorator.hashFactory (/github/workspace/node_modules/next/dist/compiled/webpack/bundle5.js:138971:18)
at BulkUpdateDecorator.update (/github/workspace/node_modules/next/dist/compiled/webpack/bundle5.js:138872:50)
at /github/workspace/node_modules/next/dist/compiled/webpack/bundle5.js:59321:9
at processTicksAndRejections (node:internal/process/task_queues:82:21)
at runNextTicks (node:internal/process/task_queues:64:3)
at process.processImmediate (node:internal/timers:442:9) {
opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
library: 'digital envelope routines',
reason: 'unsupported',
code: 'ERR_OSSL_EVP_UNSUPPORTED'
}
Node.js v18.12.0
Any idea?
I am not sure what is the cause of this error, however I managed to get it fixed by dropping borales/actions-yarn and using actions/setup-node instead. It is suggested in the actions-yarn documentation itself, it now only exists to support existing flows. Therefore this might work for you:
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout#v3
- name: Install NodeJS
uses: actions/setup-node#v3
with:
node-version: '16.16.0'
cache: 'yarn'
- name: Install dependencies
run: yarn install
- name: lint React App
run: yarn lint
- name Build React App
run:yarn build
I am using a github action pipeline and am trying to run an "npm run build" to generate an artifact that will then be used for deployment and production. Right now, my application is loaded from the local /build folder containing the built production application. This folder is populated after i make my changes and manually run "npm run build." I would instead like my pipeline to build the artifact and then deploy the application from artifact in Heroku. Here is my pipeline code:
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout#v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
# - run: npm ci
# - run: npm run build --if-present
- run: cd react-frontend && npm install
- run: cd react-frontend && npm run build
# - run: npm test --if-present ```
No artifact is being built at present
I'm trying to deploy my nextJS app on GitHub pages. I'm getting an error at the deploy stage.
My node.js.yml file contains the following:
name: Node.js CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout#v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node#v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- run: npm ci
- run: npm run build
- run: npm run export
- run: touch ./out/.nojekyll
- name: Deploy 🚀
uses: JamesIves/github-pages-deploy-action#v4.2.5
with:
branch: gh-pages # The branch the action should deploy to.
folder: out # The folder the action should deploy.
The error code there I get while deploying my repository on another branch is the following :
remote: Permission to 0xWerz/0xwerz.github.io.git denied to github-actions[bot].
fatal: unable to access 'https://github.com/0xWerz/0xwerz.github.io.git/': The requested URL returned error: 403
Running post deployment cleanup jobs… 🗑️
/usr/bin/git checkout -B github-pages-deploy-action/tpuzb7jkb
Reset branch 'github-pages-deploy-action/tpuzb7jkb'
/usr/bin/chmod -R 777 github-pages-deploy-action-temp-deployment-folder
/usr/bin/git worktree remove github-pages-deploy-action-temp-deployment-folder --force
Error: The deploy step encountered an error: The process '/usr/bin/git' failed with exit code 128 ❌
Notice: Deployment failed! ❌
The deploy action needs write access to your repository.
Or upgrade to a newer version of the action, i.e. 4.3.3
Im using jest to run tests in my monorepo.
These tests have interdependencies to other subpackages of the monorepo.
Everything works great localy.
But the gitlab-ci pipeline fails, cause it cant resolve the interdependencies...
Simplyfied project structure:
packages
-core
--src
---core.js
--package.json
-advanced
--src
---advanced.js
---advanced.test.js
--package.json
.gitlab-ci.yml
jest.config.js
package.json
Simplyfied jest.config.js:
module.exports = {
projects: ['packages/*'],
rootDir: __dirname,
roots: ['<rootDir>/packages'],
testMatch: ['**/*.test.js'],
}
Simplyfied core/package.json:
{
"name": "#myProject/core",
"version": "1.0.0"
}
Simplyfied advanced/package.json:
{
"name": "#myProject/advanced",
"version": "1.0.0",
"dependencies": {
"#myProject/core": "^1.0.0"
}
}
Simplyfied advanced.test.js:
import thisthat from 'randomBibX'
import others from 'randomBibY'
import core from '#myproject/core'
//doTests
Simplyfied package.json:
{
"scripts": {
"test": "jest"
}
"devDependencies": {
"randomBibX": "^1.0.0",
"randomBibY": "^1.0.0"
}
}
Simplyfied .gitlab-ci.yml:
image: node:10
stages:
- setup
- test
setup:
stage: setup
script:
- yarn config set cache-folder /cache/.yarn
- yarn install --non-interactive --frozen-lockfile
artifacts:
expire_in: 1hour
paths:
- node_modules
- "packages/*/node_modules"
jest:
stage: test
dependencies:
- setup
script:
- "[ ! -d node_modules/ ] && yarn install --non-interactive --frozen-lockfile"
- yarn test
The error:
FAIL packages/advanced/src/advanced.test.js
● Test suite failed to run
Cannot find module '#myProject/core' from 'advanced.test.js'
The solution was, to build the project before testing
Improved .gitlab-ci.yml:
image: node:10
stages:
- setup
- test
installAndBuild:
stage: setup
script:
- yarn config set cache-folder /cache/.yarn
- yarn install --non-interactive --frozen-lockfile
- yarn lerna run build --stream
artifacts:
expire_in: 1hour
paths:
- node_modules
- "packages/*/node_modules"
jest:
stage: test
dependencies:
- installAndBuild
script:
- "[ ! -d node_modules/ ] && yarn install --non-interactive --frozen-lockfile"
- yarn test