feat: add Cloudflare Workers IaC and deployment workflow#116
Conversation
f24411c to
79206bc
Compare
jae1911
left a comment
There was a problem hiding this comment.
Nice workflows overall, just two suggestions to optimize it further.
Please let me know what you think about this.
Also, good use of hashes when using third-party actions!
| permissions: | ||
| contents: read | ||
| pull-requests: write | ||
| env: |
There was a problem hiding this comment.
Since this job-level env directive is present twice, here and on line 95, you could merge it within the top-level env directive, where the OPENTOFU_VERSION is defined.
For later:
You could then just define the environment on the job-level directive in case of different deployment envs.
GitHub environments can also be used to ease some of that stuff: https://docs.github.com/en/actions/how-tos/deploy/configure-and-manage-deployments/manage-environments
There was a problem hiding this comment.
what would be benefit of using GitHub environments in this case?
There was a problem hiding this comment.
Currently? None. There is only a single deployment target as-is, so
using environments would be kinda overkill.
I'm just putting this out there if one day there will be a clear
separation between dev, staging and production for deployments.
Environments allow you to set their own secrets and environment
variables within each as to be able to have all the variables named the
same, while containing different values for different targets.
Just to give an example, for instance, let's assume we have two
environments: staging and production.
In the following workflow, we have a workflow_dispatch trigger event
allowing the user to deploy to a specific environment:
on:
workflow_dispatch:
inputs:
target:
description: 'Target environment.'
default: 'staging'
required: true
type: choice
options:
- staging
- production
jobs:
deploy:
environment:
name: ${{ inputs.target }}
steps:
- uses: actions/checkout@v6
- runs: ./send --to ${{ inputs.target }} --auth ${{ secrets.auth }}
# ... and so on ...In this case, the secrets.auth will be different depending on the
environment specified, despite having the same name. There's also a
bunch of other features like specify certain teams/people to approve
workflows in certain environments, etc.
Within the environment statement, you can also specify an url
parameter which will just display that deployment URL on the Actions
workflow, so more of a fancy UX thing. The other part of UX that changes
with environment is that all steps under that job will be grouped
together under that same link on the Actions status page.
But as I've mentioned, this feature is overkill for the current
pipelines, I just felt like mentioning it since it could be useful in
the future, shall the deployments become more complex.
In any case, this thread can be closed, thanks for the update!
Thanks, did some of the suggestions you mentioned. |
jae1911
left a comment
There was a problem hiding this comment.
Alright, great work on the pipelines, and thanks for listening to my advice.
I was being a bit troubled as of why install-command and build-command are left as an input in the setup Action, but seems you adapted the quality checks workflow quite nicely with the new Composite Actions, which some of those options are needed there.
Pipelines get an OK from me 👍
Description
Adds repo managed Cloudflare Workers deployment infrastructure with OpenTofu and GitHub Actions.
read
infra/README.mdfor setup and operational details.Type of change
Checklist: