withastro / action Goto Github PK
View Code? Open in Web Editor NEWA GitHub Action that deploys your Astro project to GitHub Pages
License: Other
A GitHub Action that deploys your Astro project to GitHub Pages
License: Other
I'm having this error on this repo
Running self-installer...
[Error: ENOENT: no such file or directory, open '/home/runner/work/chinese-character-writing-practice/chinese-character-writing-practice/package.json'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '/home/runner/work/chinese-character-writing-practice/chinese-character-writing-practice/package.json'
}
Error: Error: ENOENT: no such file or directory, open '/home/runner/work/chinese-character-writing-practice/chinese-character-writing-practice/package.json'
Path is assigned at workflow, but isn't working
i use datetime function.
but at the time of build using github action the results of the datetime are not as expected.
how to set timezone to Asia/Jakarta ?
Hey folks, I just tried to use this action in a GHES environment and wasn't able to because the versions of setup-node
and upload-pages-artifact
aren't supported on my GHES version.
It would be great if I could specify which versions of these actions to allow compatibility with GHES.
Thanks!
I bumped my Astro website Node version to 20 earlier today, but discovered I could no longer build and deploy via Github pages.
There's a related Node 20 bug, which is now closed.
And the related PR has been merged.
So... I have just modified my Github pages workflow YML with latest versions:
https://github.com/basher/basher-website/blob/master/.github/workflows/static.yml
But... I'm still getting build errors. The error doesn't provide me with any useful info:
https://github.com/basher/basher-website/actions/runs/7974519592/job/21770594265#step:3:41
Any ideas??? 🤔
I'm having a problem understanding how exactly it is I'm supposed to set the environment variables for my astro project that i'm deploying to github pages. I've set an environment variable inside my github repo but from what I understand it's not accessible through withastro/action@v1
Currently, available options of withastro/action@v2
is a subset of those of actions/setup-node@v4
.
For example, node-version-file
is not available.
In my usecase, I define Node.js as engines.node
in package.json
.
If I use actions/setup-node@v4
directly, I can specify node-version-file
so that it reads the property.
Without this option, I have to manually sync Node.js versions in 2 files, workflow YAML file and package.json
.
By the way, pnpm/action-setup@v3
automatically detects package manager and its version based on packageManager
property in package.json
, if package-manager
of withastro/action@v2
is not specified, which enables me to manage package manager version in one place.
It may be fine to support other options of actions/setup-node@v4
too.
Hi, I tried to use this action with my repo. And I see it doesn't run if my repo doesn't have a lock file. Please enable running this action without a lockfile.
Earlier builds passed with the log:
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:f43a0e5ff2bd294095638e18286ca9a3d1956744)
Download action repository 'withastro/action@v1' (SHA:f122c0232093b3504e4c841a46c2eebd07c47392)
Getting action download info
Download action repository 'pnpm/action-setup@v2' (SHA:d882d12c64e032187b2edb46d3a0d003b7a43598)
Download action repository 'oven-sh/setup-bun@v1' (SHA:a1800f471a0bc25cddac36bb13e6f436ddf341d7)
Download action repository 'actions/setup-node@v3' (SHA:1a4442cacd436585916779262731d5b162bc6ec7)
Download action repository 'actions/upload-pages-artifact@v1' (SHA:84bb4cd4b733d5c320c9c9cfbc354937524f4d64)
Getting action download info
Download action repository 'actions/upload-artifact@v3' (SHA:a8a3f3ad30e3422c9c7b888a15615d19a852ae32)
Complete job name: build
However, a run triggered by the latest version resulted in:
Secret source: Actions
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v3' (SHA:f43a0e5ff2bd294095638e18286ca9a3d1956744)
Download action repository 'withastro/action@v1' (SHA:64c331d10da115fbaab6c13ceb8d64f06199a703)
Error: withastro/action/v1/action.yml (Line: 96, Col: 7): Unexpected value 'working-directory'
Error: GitHub.DistributedTask.ObjectTemplating.TemplateValidationException: The template is not valid. withastro/action/v1/action.yml (Line: 96, Col: 7): Unexpected value 'working-directory'
at GitHub.DistributedTask.ObjectTemplating.TemplateValidationErrors.Check()
at GitHub.Runner.Worker.ActionManifestManager.ConvertRuns(IExecutionContext executionContext, TemplateContext templateContext, TemplateToken inputsToken, String fileRelativePath, MappingToken outputs)
at GitHub.Runner.Worker.ActionManifestManager.Load(IExecutionContext executionContext, String manifestFile)
Error: Fail to load withastro/action/v1/action.yml
I am following the Deploy your Astro Site to GitHub Pages manual, but always get following warning:
build
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: pnpm/action-setup@v2. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
The .github/workflows/deploy.yml file looks fine to me:
name: Deploy the AstroBlogTutorial to GitHub Pages
on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install, build, and upload your site
uses: withastro/action@v2
with:
node-version: 20
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Is this a bug, or my error? I am new to GitHub actions...
Hi,
Thanks for this project. I am unable to deploy my documentation site using this action. I am getting the following error.
Error: Some specified paths were not resolved, unable to cache dependencies.
I think it is coming due to the fact that setup-node is trying to locate the cache inside apps/docs folder but since it is a monorepo, it is located two levels up.
From the job run, I noticed this:
cache-dependency-path: ./apps/docs/yarn.lock
There is no yarn.lock
inside apps/docs
since this is a monorepo.
Github job: https://github.com/codelitdev/courselit/actions/runs/4132972124/jobs/7142310620
Before today, it was working fine.
I have a repo where the docs are colocated with source, but crucially not as a monorepo, just sibling directories. My npm run build
command builds source, not astro. Of course i can && npm run build:astro
or something at the end, but that just complicates things. Nor do I want to make astro my main build
script. Would be nice if it were configurable somehow, but default to build
for backward compatibility.
Happy to make a PR if you think this is OK
I have noticed that the package-manger bun@somthing still requires you to specify node_version.
I am willing to fix that issue.
I think, the Check lockfiles
step should respect the path
.
I've a repo that contains multiple package-lock.json
files which causes this failure:
elif [ $(find "." -name "package-lock.json") ]; then
/var/run/act/workflow/2-composite-0.sh: line 17: [: ./package-lock.json: binary operator expected
The $()
variable contains multiple lines and this is something the [
doesn't like.
Using $(find ${{ inputs.path }} -name "package-lock.json")
should do the trick.
My Astro site is located in the apps/docs
directory of my project (a monorepo) and following is my deployment action file.
name: Deploy documentation
on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
inputs:
path:
description: 'Path to your Astro project'
required: true
default: './apps/docs'
type: string
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v2
- name: Install, build, and upload your site
uses: withastro/action@v0
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
The workflow is not running inside the specified folder i.e. apps/docs
. What is the problem?
Maybe I am doing something wrong, but I cannot for the life of me deploy from a yarn workspaces monorepo.
I added the base:
// astro.config.msj
{
base: '/docs',
}
It won't build properly because it won't build my other dependencies.
So if I remove the base, it fails because it can't find the docs/dist
directory.
I need a way to build from the root and deploy from a path, but it doesn't seem as though one is exposed.
I want to bump the action/deploy-pages
version to v4
as it supports node 20 (actions/deploy-pages#256) but I am unable to do so because the current version of withastro/[email protected]
is not compatible with it. I get this while running the workflow:
Fetching artifact metadata for "github-pages" in this workflow run
Found 0 artifact(s)
Error: Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages, or Actions? Please re-run the deployment at a later time.
Error: Error: No artifacts named "github-pages" were found for this workflow run. Ensure artifacts are uploaded with actions/artifact@v4 or later.
at getArtifactMetadata (/home/runner/work/_actions/actions/deploy-pages/v4.0.3/src/internal/api-client.js:85:1)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Deployment.create (/home/runner/work/_actions/actions/deploy-pages/v4.0.3/src/internal/deployment.js:66:1)
at main (/home/runner/work/_actions/actions/deploy-pages/v4.0.3/src/index.js:30:1)
Error: Error: No artifacts named "github-pages" were found for this workflow run. Ensure artifacts are uploaded with actions/artifact@v4 or later.
warning from github actions while using action/deploy-pages@v3
:
[build](https://github.com/murtuzaalisurti/murtuzaalisurti.github.io/actions/runs/7684619378/job/20941330307)
Node.js 16 actions are deprecated. Please update the following actions to use Node.js 20: actions/upload-artifact@v3. For more information see: https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/.
This is my GitHub Actions:
# To get started with Astro see: https://docs.astro.build/en/getting-started
name: Deploy Astro site to Pages
on:
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v4
- name: Install, build, and upload your site
uses: withastro/action@v1
with:
node-version: 20
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
And this is log with Deploy to GitHub Pages
:
Fetching artifact metadata for github-pages in run 7264272115
Error: Fetching artifact metadata failed. Is githubstatus.com reporting issues with API requests, Pages or Actions? Please re-run the deployment at a later time.
Error: Error: No artifacts found for workflow run 7264272[11](https://github.com/MedPocket/18-months/actions/runs/7264272115/job/19791485992#step:2:12)5. Ensure artifacts are uploaded with actions/artifact@v4 or later.
at getArtifactMetadata (/home/runner/work/_actions/actions/deploy-pages/v4/src/internal/api-client.js:24:1)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at Deployment.create (/home/runner/work/_actions/actions/deploy-pages/v4/src/internal/deployment.js:66:1)
at main (/home/runner/work/_actions/actions/deploy-pages/v4/src/index.js:30:1)
Error: Error: No artifacts found for workflow run 72642721[15](https://github.com/MedPocket/18-months/actions/runs/7264272115/job/19791485992#step:2:16). Ensure artifacts are uploaded with actions/artifact@v4 or later.
It would be great to have an option to set cli flags on the astro build
command.
Specifically, I'd like to specify the --config
flag to deploy a static version of my site.
Reference: https://docs.astro.build/en/reference/cli-reference/
I'm using pnpm v8.6.1 locally and the CI uses the v7 version of pnpm. The mismatch of versions will cause errors in CI.
The discussion https://github.com/orgs/pnpm/discussions/6633 describes the same issue.
2023-06-30T15:41:58.5412888Z env:
2023-06-30T15:41:58.5413087Z INPUT_PM: pnpm
2023-06-30T15:41:58.5413283Z ##[endgroup]
2023-06-30T15:41:58.5651094Z ##[group]Run pnpm/[email protected]
2023-06-30T15:41:58.5651344Z with:
2023-06-30T15:41:58.5651530Z version: 7.x.x
2023-06-30T15:41:58.5651735Z dest: ~/setup-pnpm
2023-06-30T15:41:58.5651942Z run_install: null
2023-06-30T15:41:58.5652117Z env:
2023-06-30T15:41:58.5652311Z PACKAGE_MANAGER: pnpm
2023-06-30T15:41:58.5652518Z ##[endgroup]
2023-06-30T15:41:58.6814194Z ##[warning]The `save-state` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2023-06-30T15:41:58.6855768Z ##[group]Running self-installer...
2023-06-30T15:41:59.2019803Z Progress: resolved 1, reused 0, downloaded 0, added 0
2023-06-30T15:41:59.2122840Z Packages: +1
2023-06-30T15:41:59.2123272Z +
2023-06-30T15:41:59.9078948Z Packages are hard linked from the content-addressable store to the virtual store.
2023-06-30T15:41:59.9079890Z Content-addressable store is at: /home/runner/.pnpm-store/v3
2023-06-30T15:41:59.9080964Z Virtual store is at: node_modules/.pnpm
2023-06-30T15:41:59.9338720Z
2023-06-30T15:41:59.9339435Z dependencies:
2023-06-30T15:41:59.9340277Z + pnpm 7.33.2 (8.6.5 is available)
2023-06-30T15:41:59.9341316Z
2023-06-30T15:42:00.2034805Z Progress: resolved 1, reused 0, downloaded 1, added 1, done
2023-06-30T15:42:00.2158390Z ##[endgroup]
2023-06-30T15:42:00.2162206Z Installation Completed!
2023-06-30T15:42:00.2166092Z
2023-06-30T15:42:00.2170961Z ##[warning]The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2023-06-30T15:42:00.2173245Z
2023-06-30T15:42:00.2174927Z ##[warning]The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files. For more information see: https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/
2023-06-30T15:42:00.2300941Z ##[group]Run actions/setup-node@v3
2023-06-30T15:42:00.2301166Z with:
2023-06-30T15:42:00.2301356Z node-version: 18
2023-06-30T15:42:00.2301542Z cache: pnpm
2023-06-30T15:42:00.2301763Z cache-dependency-path: ./
2023-06-30T15:42:00.2301995Z always-auth: false
2023-06-30T15:42:00.2302195Z check-latest: false
2023-06-30T15:42:00.2302502Z token: ***
2023-06-30T15:42:00.2302700Z env:
2023-06-30T15:42:00.2302883Z PACKAGE_MANAGER: pnpm
2023-06-30T15:42:00.2303151Z PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
2023-06-30T15:42:00.2303396Z ##[endgroup]
2023-06-30T15:42:00.4370664Z Found in cache @ /opt/hostedtoolcache/node/18.16.1/x64
2023-06-30T15:42:00.4382087Z ##[group]Environment details
2023-06-30T15:42:01.0826454Z node: v18.16.1
2023-06-30T15:42:01.0826898Z npm: 9.5.1
2023-06-30T15:42:01.0827164Z yarn: 1.22.19
2023-06-30T15:42:01.0836030Z ##[endgroup]
2023-06-30T15:42:01.0840333Z [command]/home/runner/setup-pnpm/node_modules/.bin/pnpm store path --silent
2023-06-30T15:42:01.6174066Z /home/runner/setup-pnpm/node_modules/.bin/store/v3
2023-06-30T15:42:03.0397299Z pnpm cache is not found
2023-06-30T15:42:03.0488434Z ##[group]Run cd .
2023-06-30T15:42:03.0488642Z �[36;1mcd .�[0m
2023-06-30T15:42:03.0488853Z �[36;1m$PACKAGE_MANAGER install�[0m
2023-06-30T15:42:03.0542055Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2023-06-30T15:42:03.0542307Z env:
2023-06-30T15:42:03.0542673Z PACKAGE_MANAGER: pnpm
2023-06-30T15:42:03.0542948Z PNPM_HOME: /home/runner/setup-pnpm/node_modules/.bin
2023-06-30T15:42:03.0543188Z ##[endgroup]
2023-06-30T15:42:03.6418968Z ERR_PNPM_LOCKFILE_CONFIG_MISMATCH Cannot proceed with the frozen installation. The current "settings.autoInstallPeers" configuration doesn't match the value found in the lockfile
2023-06-30T15:42:03.6419635Z
2023-06-30T15:42:03.6421292Z Update your lockfile using "pnpm install --no-frozen-lockfile"
2023-06-30T15:42:03.6621404Z ##[error]Process completed with exit code 1.
name: Deploy to GitHub Pages
on:
# Trigger the workflow every time you push to the `main` branch
# Using a different branch name? Replace `main` with your branch’s name
push:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab on GitHub.
workflow_dispatch:
# Allow this job to clone the repo and create a page deployment
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout your repository using git
uses: actions/checkout@v3
- name: Install, build, and upload your site
uses: withastro/action@v0
with:
path: . # The root location of your Astro project inside the repository. (optional)
node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 16. (optional)
package-manager: pnpm # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.