Skip to content
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

docs: Add GitLab Pages deploy option #1548

Merged
merged 6 commits into from May 22, 2024

Conversation

adam-hudak
Copy link
Contributor

@adam-hudak adam-hudak commented Apr 5, 2024

πŸ”— Linked issue

resolves nuxt/nuxt#26599

❓ Type of change

  • πŸ“– Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

Add GitLab Pages deploy option

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have added tests (if possible).
  • I have updated the documentation accordingly.

@Atinux
Copy link
Member

Atinux commented Apr 8, 2024

By reading https://docs.gitlab.com/ee/user/project/pages/introduction.html#customize-the-default-folder

We can instead tell GitLab to look at the dist/ directory instead @adam-hudak

pages:
  script:
    - npm run generate
  artifacts:
    paths:
      - dist
  publish: dist

content/3.deploy/gitlab.md Outdated Show resolved Hide resolved
content/3.deploy/gitlab.md Outdated Show resolved Hide resolved
content/3.deploy/gitlab.md Outdated Show resolved Hide resolved
@adam-hudak
Copy link
Contributor Author

Thank you for your comments @alexchopin , @pi0 .

I updated the documentation, remove everything that we don't need and now there is a clean, minimalistic page ❀️

It's beautiful how easy it is to deploy the Nuxt app. Good job guys πŸ‘

@adam-hudak adam-hudak requested a review from pi0 April 8, 2024 14:54
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks overall looks good but we still need a Nitro preset to officially support this target, if you like to help.

@adam-hudak
Copy link
Contributor Author

Yes @pi0 , I would like to help. So what you suggest is to write a preset that build an application to /public directory?

@Atinux
Copy link
Member

Atinux commented Apr 9, 2024

@adam-hudak you can take a look at the github pages preset for Nitro: https://github.com/unjs/nitro/blob/main/src/presets/github-pages.ts

@adam-hudak
Copy link
Contributor Author

@Atinux I also checked other presets in the codebase before, but I think I don't understand what is a function of a preset.

From documentation:
Nitro can generate different output formats suitable for different hosting providers from the same code base. Using built-in presets, you can easily configure Nitro to adjust its output format with almost no additional code or configuration!

What output format do I want to achieve? When I look at the differences between presets/github-pages.ts and presents/nitro-dev.ts. I can see that github-pages uses extends: "static", then render 404 page and github specific file .nojekyll. github-pages.ts also define a deploy command, but then in GitHub Pages documentation we define the other deploy job.

For GitLab we also need extends: "static". But I don't understand how it affects Nuxt GitLab Pages deployment process.

Please can you help me understand it better? I am looking for a solution that is not framework specific and would like to know the best approach to achieve this.

Thank you

Comment on lines +21 to +28
image: node:lts
# Functions that should be executed before the build script is run
before_script:
- npm install
cache:
paths:
# Directories that are cached between builds
- node_modules/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I came across this by chance. I would not set this part globally, but only give it directly to the pages job. Otherwise this part would potentially be breaking for other jobs in the pipeline :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to open another PR to update it @OrbisK ? πŸ™

Copy link
Contributor

@OrbisK OrbisK May 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to open another PR to update it @OrbisK ? πŸ™

Sure, ill do

Copy link
Member

@danielroe danielroe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the comment on cache.paths, is there any reason not to merge this, and then update when we have a Nitro preset?

@Atinux Atinux merged commit 1301666 into nuxt:main May 22, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

πŸ“šDocs: Gitlab Pages deployment guide
5 participants