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

Transitioning from Node 16 to Node 20 #117

Open
fatihsever opened this issue Jan 25, 2024 · 27 comments
Open

Transitioning from Node 16 to Node 20 #117

fatihsever opened this issue Jan 25, 2024 · 27 comments

Comments

@fatihsever
Copy link

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
Copy link

AVGVSTVS96 commented Feb 6, 2024

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

@jonathanspw
Copy link

Bump

@jeroensmink98
Copy link

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

@sebdanielsson
Copy link

Have someone tried reaching out on their Discord?

@IanVS
Copy link
Contributor

IanVS commented Mar 5, 2024

There's an unmerged PR that would fix this, it looks like #118.

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

@JesusValera
Copy link

Bump

@cristianmadularu
Copy link

Any updates?

@emad0082
Copy link

Bump

@cristianmadularu
Copy link

cristianmadularu commented Mar 19, 2024

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
Copy link

codyro commented Apr 5, 2024

Bump

@gkorakas-eli
Copy link

Any updates on this?

@naiyerasif
Copy link

naiyerasif commented Apr 13, 2024

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
Copy link

Ah great, thank you!

@fatihsever
Copy link
Author

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
Copy link

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
Copy link

@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
Copy link

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

fornwall added a commit to fornwall/advent-of-code that referenced this issue May 3, 2024
devshred added a commit to devshred/gps-tools-frontend that referenced this issue May 5, 2024
Switch to wrangler-action, since pages-action no longer works. see:
cloudflare/pages-action#117
@vorant94
Copy link

vorant94 commented May 7, 2024

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
Copy link

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
Copy link

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
Copy link

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
Copy link

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.

pages-action/src/index.ts

Lines 146 to 149 in aeb0d93

if (gitHubToken && gitHubToken.length) {
const octokit = getOctokit(gitHubToken);
gitHubDeployment = await createGitHubDeployment(octokit, productionEnvironment, environmentName);
}

iBug added a commit to iBug/iBug-source that referenced this issue May 15, 2024
iBug pushed a commit to iBugOne/iBugOne.github.io that referenced this issue May 15, 2024
[158dca2] Actions: Replace pages-action with wrangler-action

cloudflare/pages-action#117
iBug added a commit to iBug/iBug-source that referenced this issue May 15, 2024
iBug pushed a commit to iBugOne/iBugOne.github.io that referenced this issue May 15, 2024
[3bb753c] Actions: Replace pages-action with wrangler-action

cloudflare/pages-action#117
@IanVS
Copy link
Contributor

IanVS commented Jul 3, 2024

It sounds like there are indeed plans to deprecate this action and move folks to action-wrangler: #131 (comment)

@sebdanielsson
Copy link

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
Copy link

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
Copy link

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...

kdeldycke added a commit to kdeldycke/kevin-deldycke-blog that referenced this issue Jul 9, 2024
@aaronadamsCA
Copy link
Contributor

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests