cloudflare / pages-action

🛑 DEPRECATED, please use wrangler-action
MIT License
476 stars 100 forks source link

Transitioning from Node 16 to Node 20 #117

Open fatihsever opened 10 months ago

fatihsever commented 10 months ago

Node.js 16 actions are deprecated. Please update the action to use Node.js 20.

https://github.blog/changelog/2023-09-22-github-actions-transitioning-from-node-16-to-node-20/

The transition seems easy. For example, the official cache action completed the transition with a few file updates: https://github.com/actions/cache/pull/1284/files

Thanks.

AVGVSTVS96 commented 9 months ago

@cloudflare Is this getting updated? I'm surprised to see no updates on this official Cloudflare action.

jonathanspw commented 9 months ago

Bump

jeroensmink98 commented 9 months ago

I'm getting the same, wondering when Cloudflare will update this action?

sebdanielsson commented 9 months ago

Have someone tried reaching out on their Discord?

IanVS commented 8 months ago

There's an unmerged PR that would fix this, it looks like https://github.com/cloudflare/pages-action/pull/118.

Maybe it's time to look for an unofficial pages action, or fork this one, since it seems to be unmaintained.

JesusValera commented 8 months ago

Bump

cristianmadularu commented 8 months ago

Any updates?

emad0082 commented 8 months ago

Bump

cristianmadularu commented 8 months ago

I raised on their Discord as well where they indicated that they were aware of it but there is no indication regarding the time frame when it would be adressed.

codyro commented 7 months ago

Bump

gkorakas-eli commented 7 months ago

Any updates on this?

naiyerasif commented 7 months ago

Just an FYI for people still waiting for updates on this action, you can directly use cloudflare/wrangler-action@v3 (which uses Node.js 20) to deploy a site on Cloudflare Pages.

For example, say, you had the following step configuration using cloudflare/pages-action@v1:

- name: Publish to Cloudflare Pages
  uses: cloudflare/pages-action@v1
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
    directory: dist

You can swap the above configuration with the following step configuration:

- name: Deploy to Cloudflare Pages
  uses: cloudflare/wrangler-action@v3
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    command: pages deploy dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --commit-dirty=true
cristianmadularu commented 7 months ago

Ah great, thank you!

fatihsever commented 7 months ago

Just an FYI for people still waiting for updates on this action, you can directly use cloudflare/wrangler-action@v3 (which uses Node.js 20) to deploy a site on Cloudflare Pages.

This is great news! I will switch to it asap. Thanks @naiyerasif.

wmitsuda commented 7 months ago

Is wrangler-action going to succeed pages-action (which seems completely abandoned)?

if so, it would be nice if someone from CF at least could make a public statement and update the docs (which direct users to use pages-action for direct uploads).

cristianmadularu commented 7 months ago

@wmitsuda I do not know and CF does not seem to reply, but, I have tried the wrangler action as indicated by @naiyerasif and it works great.

wmitsuda commented 7 months ago

I just migrated it and it is working for me as well. It is a shame CF does not care for proper communication.

vorant94 commented 6 months ago

pages-action has gitHubToken param to enable GitHub Deployments.

Does anyone from those who migrated to wrangler-action know if it also has support for it?

I don't see gitHubToken on wrangler-action README as of now...

cristianmadularu commented 6 months ago

pages-action has gitHubToken param to enable GitHub Deployments.

Does anyone from those who migrated to wrangler-action know if it also has support for it?

I don't see gitHubToken on wrangler-action README as of now...

I did not have to change anyting other than the action to be used and it worked for me.

davidhouweling commented 6 months ago

the difference between wrangler-action and pages-action is that wrangler-action is used to deploy to cloudflare specifically (which this uses). This action extends that capability with the ability to post message to github + deployment status. that's what the github token is used for.

naiyerasif commented 6 months ago

the difference between wrangler-action and pages-action is that wrangler-action is used to deploy to cloudflare specifically (which this uses). This action extends that capability with the ability to post message to github + deployment status. that's what the github token is used for.

You can publish the deployment status with a job summary while using wrangler-action. You don't necessarily need a token to do this (until and unless you're doing something with GitHub's API).

You can find additional examples and documentation on Job Summaries at the following links.

davidhouweling commented 6 months ago

Thanks @naiyerasif for the info and I was definitely wanting something like that. I think my point still stands though if you're purely looking at it as a 1:1 comparison between this and wranger. My comment was based on looking at the code directly.

https://github.com/cloudflare/pages-action/blob/aeb0d936a7e08b4861c3d0ac8811fe39138085f9/src/index.ts#L146-L149

IanVS commented 4 months ago

It sounds like there are indeed plans to deprecate this action and move folks to action-wrangler: https://github.com/cloudflare/pages-action/issues/131#issuecomment-2203648174

sebdanielsson commented 4 months ago

Just an FYI for people still waiting for updates on this action, you can directly use cloudflare/wrangler-action@v3 (which uses Node.js 20) to deploy a site on Cloudflare Pages.

For example, say, you had the following step configuration using cloudflare/pages-action@v1:

- name: Publish to Cloudflare Pages
  uses: cloudflare/pages-action@v1
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
    directory: dist

You can swap the above configuration with the following step configuration:

- name: Deploy to Cloudflare Pages
  uses: cloudflare/wrangler-action@v3
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    command: pages deploy dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --commit-dirty=true

Will this step still deploy PRs to the preview environment and pushes to main to the production environment?

naiyerasif commented 4 months ago

Just an FYI for people still waiting for updates on this action, you can directly use cloudflare/wrangler-action@v3 (which uses Node.js 20) to deploy a site on Cloudflare Pages. For example, say, you had the following step configuration using cloudflare/pages-action@v1:

- name: Publish to Cloudflare Pages
  uses: cloudflare/pages-action@v1
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
    directory: dist

You can swap the above configuration with the following step configuration:

- name: Deploy to Cloudflare Pages
  uses: cloudflare/wrangler-action@v3
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    command: pages deploy dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --commit-dirty=true

Will this step still deploy PRs to the preview environment and pushes to main to the production environment?

That depends on your branch deployment controls rather than wrangler command.

sebdanielsson commented 4 months ago

Just an FYI for people still waiting for updates on this action, you can directly use cloudflare/wrangler-action@v3 (which uses Node.js 20) to deploy a site on Cloudflare Pages. For example, say, you had the following step configuration using cloudflare/pages-action@v1:

- name: Publish to Cloudflare Pages
  uses: cloudflare/pages-action@v1
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    projectName: ${{ vars.CLOUDFLARE_PROJECT_NAME }}
    directory: dist

You can swap the above configuration with the following step configuration:

- name: Deploy to Cloudflare Pages
  uses: cloudflare/wrangler-action@v3
  with:
    apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
    accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
    command: pages deploy dist --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }} --commit-dirty=true

Will this step still deploy PRs to the preview environment and pushes to main to the production environment?

That depends on your branch deployment controls rather than wrangler command.

Sorry, I was a bit unclear with my comment. I meant if it would still update the GitHub deployment status, but as far as I can tell, it doesn't. I've created a feature request for this in the wrangler-action repository...

aaronadamsCA commented 2 months ago

The job steps below should recreate this action's deployment statuses when moving to the new action. They assume you already have a wrangler.toml file, otherwise you'll need to pass more arguments to the pages deploy command.

- id: create_deployment
  name: Create GitHub deployment
  run: |
    echo "id=$(
      gh api 'repos/{owner}/{repo}/deployments' \
        -f 'ref=${{ github.ref_name }}' \
        -F 'auto_merge=false' \
        -F 'required_contexts[]' \
        -f 'environment=${{ vars.CLOUDFLARE_PROJECT_NAME }} (${{ github.ref_name == 'main' && 'Production' || 'Preview' }})' \
        -F 'production_environment=${{ github.ref_name == 'main' && 'true' || 'false' }}' \
        -q '.id'
    )" >> "$GITHUB_OUTPUT"
  env:
    GH_TOKEN: ${{ github.token }}
- id: deploy
  name: Deploy to Cloudflare Pages
  uses: cloudflare/wrangler-action@v3
  with:
    accountId: "${{ vars.CLOUDFLARE_ACCOUNT_ID }}"
    apiToken: "${{ secrets.CLOUDFLARE_API_TOKEN }}"
    command: pages deploy
    workingDirectory: "${{ vars.WORKING_DIRECTORY }}"
- name: Create GitHub deployment status
  run: |
    gh api 'repos/{owner}/{repo}/deployments/${{ steps.create_deployment.outputs.id }}/statuses' \
      -f 'state=success' \
      -f 'environment_url=${{ steps.deploy.outputs.deployment-url }}' \
      -F 'auto_inactive=false'
  env:
    GH_TOKEN: ${{ github.token }}

This is very verbose, but you also get control of a lot of things you can't control today.