Open fatihsever opened 10 months ago
@cloudflare Is this getting updated? I'm surprised to see no updates on this official Cloudflare action.
Bump
I'm getting the same, wondering when Cloudflare will update this action?
Have someone tried reaching out on their Discord?
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.
Bump
Any updates?
Bump
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.
Bump
Any updates on this?
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
Ah great, thank you!
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.
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).
@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.
I just migrated it and it is working for me as well. It is a shame CF does not care for proper communication.
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...
pages-action
hasgitHubToken
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
onwrangler-action
README
as of now...
I did not have to change anyting other than the action to be used and it worked for me.
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.
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.
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.
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
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?
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.
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...
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.
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.