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

Setup Cloudflare deploys via Github Action #289

Merged
merged 1 commit into from
Apr 20, 2023
Merged

Conversation

buberdds
Copy link
Contributor

@buberdds buberdds commented Apr 14, 2023

Requires: CLOUDFRONT_API_TOKEN and CLOUDFRONT_ACCOUNT_ID secrets on repo level
https://github.com/oasisprotocol/explorer/settings/secrets/actions

Setup:


  • CloudFlare builds&deploys are slow (> 3m)
  • Currently we control everything via CloudFlare dashboard options and most of us cannot access it
  • GH action would allow us to omit CloudFlare Pages limit (1 deploy per repo) if we would like to deploy Storybook one day

Sample output:
default: buberdds#20
skipped for Renovate bot: buberdds#22

@cloudflare-pages
Copy link

cloudflare-pages bot commented Apr 14, 2023

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: cfe1f45
Status: ✅  Deploy successful!
Preview URL: https://27574a63.oasis-explorer.pages.dev
Branch Preview URL: https://mz-cloudflare.oasis-explorer.pages.dev

View logs

.github/workflows/cloudflare.yml Outdated Show resolved Hide resolved
.github/workflows/cloudflare.yml Outdated Show resolved Hide resolved
.github/workflows/cloudflare.yml Outdated Show resolved Hide resolved
.github/workflows/cloudflare.yml Outdated Show resolved Hide resolved
.github/workflows/cloudflare.yml Outdated Show resolved Hide resolved
.github/workflows/cloudflare.yml Outdated Show resolved Hide resolved
@buberdds buberdds force-pushed the mz/cloudflare branch 2 times, most recently from 7803bf9 to 0b725da Compare April 18, 2023 14:51
@github-actions
Copy link

github-actions bot commented Apr 18, 2023

Deployed to Cloudflare Pages

Latest commit:
Status:✅ Deploy successful!
Preview URL:

@buberdds buberdds requested a review from tjanez April 18, 2023 15:08
Copy link
Member

@lukaw3d lukaw3d left a comment

Choose a reason for hiding this comment

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

Looks like it would work well 👍 needs a token

.github/workflows/cloudflare.yml Outdated Show resolved Hide resolved
@buberdds buberdds force-pushed the mz/cloudflare branch 4 times, most recently from b738c1e to e99bf93 Compare April 19, 2023 11:02
@buberdds
Copy link
Contributor Author

buberdds commented Apr 19, 2023

@tjanez API Token description updated. We only need Cloudflare Pages Edit permission. Tested on fork buberdds#30

https://github.com/cloudflare/pages-action#generate-an-api-token

https://dash.cloudflare.com/profile/api-tokens -> Create ->
At the bottom under Custom Token -> Get started ->
Provide Token name ->
Under Permissions, select Account, Cloudflare Pages and Edit
Select Continue to summary > Create Token

Copy link
Member

@tjanez tjanez left a comment

Choose a reason for hiding this comment

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

I've added the secrets, so let's check if this works.

.github/workflows/cloudflare-pages.yml Outdated Show resolved Hide resolved
.github/workflows/cloudflare-pages.yml Outdated Show resolved Hide resolved
@tjanez tjanez changed the title Setup CloudFlare deploys via Github Action Setup Cloudflare deploys via Github Action Apr 19, 2023
@buberdds buberdds force-pushed the mz/cloudflare branch 2 times, most recently from 2204c2f to 62f8165 Compare April 19, 2023 13:49
@buberdds
Copy link
Contributor Author

buberdds commented Apr 19, 2023

Thanks, secrets look Ok. We can remove Github App integration before merge. https://github.com/oasisprotocol/explorer/settings/installations

@lukaw3d
Copy link
Member

lukaw3d commented Apr 19, 2023

Something is wrong:

Old bot: Latest commit: 62f8165, Preview URL: https://ee885e51.oasis-explorer.pages.dev/
open, see footer "Version: 62f8165"

New workflow: Latest commit: 62f8165d829668803f55e405d4d33ddc2af61b37, Preview URL: https://b773861d.oasis-explorer.pages.dev
open, see footer "Version: aad8eec" ⚠️

@buberdds
Copy link
Contributor Author

hmm how this is even possible that footer getBuildData has a different commit ?

@lukaw3d
Copy link
Member

lukaw3d commented Apr 19, 2023

CI logs say: HEAD is now at aad8eec Merge 62f8165d829668803f55e405d4d33ddc2af61b37 into 365768cfb7e7d74ba7d4424989a8c3406bb8da91

Is github by default doing "merged results pipelines" (gitlab term)? :O

@lukaw3d
Copy link
Member

lukaw3d commented Apr 19, 2023

I guess this is fine 🤷

@buberdds
Copy link
Contributor Author

@lukaw3d
Copy link
Member

lukaw3d commented Apr 19, 2023

that might work - even on push event

the other alternative is https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target but looks like it carries extra risk

@buberdds
Copy link
Contributor Author

I will merge and disable until switch

@buberdds buberdds merged commit b74856e into master Apr 20, 2023
@buberdds buberdds deleted the mz/cloudflare branch April 20, 2023 08:10
<td><a href="${{ steps.cloudflare.outputs.url }}">${{ steps.cloudflare.outputs.url }}</a></td>
</tr>
</table>
message-failure: |
Copy link
Member

Choose a reason for hiding this comment

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

We should have message-cancelled too
see: #289 (comment)
image

from a cancelled run: https://github.com/oasisprotocol/explorer/actions/runs/4752003232/jobs/8441821763

Copy link
Member

Choose a reason for hiding this comment

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

Fixed by #314

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

Successfully merging this pull request may close these issues.

None yet

3 participants