{"id":21066498,"url":"https://github.com/eidam/gitlab-wrangler-action","last_synced_at":"2025-05-16T03:31:57.868Z","repository":{"id":43668976,"uuid":"342866371","full_name":"eidam/gitlab-wrangler-action","owner":"eidam","description":"✨ Zero-config Cloudflare Workers deployment using Wrangler and Gitlab CI/CD. Same as Wrangler Action, but for Gitlab.","archived":false,"fork":false,"pushed_at":"2021-02-27T17:59:06.000Z","size":4,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-03-04T16:33:35.498Z","etag":null,"topics":["gitlab","gitlab-ci","wrangler","wrangler-cli"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eidam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-27T13:44:52.000Z","updated_at":"2022-05-08T17:26:19.000Z","dependencies_parsed_at":"2022-09-21T08:33:36.072Z","dependency_job_id":null,"html_url":"https://github.com/eidam/gitlab-wrangler-action","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidam%2Fgitlab-wrangler-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidam%2Fgitlab-wrangler-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidam%2Fgitlab-wrangler-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eidam%2Fgitlab-wrangler-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eidam","download_url":"https://codeload.github.com/eidam/gitlab-wrangler-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225402462,"owners_count":17468832,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gitlab","gitlab-ci","wrangler","wrangler-cli"],"created_at":"2024-11-19T17:59:56.910Z","updated_at":"2024-11-19T17:59:57.728Z","avatar_url":"https://github.com/eidam.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wrangler Action for Gitlab CI/CD\n\n✨ Zero-config [Cloudflare Workers](https://workers.cloudflare.com) deployment using [Wrangler](https://github.com/cloudflare/wrangler) and [Gitlab CI/CD](https://docs.gitlab.com/ee/ci/)\n\nBuilt from Cloudflare's [Wrangler Action](https://github.com/cloudflare/wrangler-action) and should be fairly easy to migrate between them as it uses same deployment script in the background.\n\n## Usage\n\nAdd `gitlab-wrangler-action` to the CI/CD configuration of your Gitlab repository. The below example will publish your application on pushes to the `master` branch:\n\n```yaml\ninclude: \n  - remote: \"https://raw.githubusercontent.com/eidam/gitlab-wrangler-action/main/templates/1.3.0.yml\"\n\nstages:\n  - deploy\n\nwrangler deploy:\n  extends: .wrangler_deploy\n  stage: deploy\n  rules:\n    - if: '$CI_COMMIT_BRANCH == \"master\"'\n```\n\n## Authentication\n\nYou'll need to configure Wrangler using Gitlab CI/CD variables feature - go to \"Settings -\u003e CI/CD -\u003e Variables\" and add your Cloudflare API token (for help finding this, see the [Workers documentation](https://developers.cloudflare.com/workers/quickstart/#api-token)). Your API token is encrypted by Gitlab, and the action won't print it into logs _(make sure you select \"Mask variable\" option)_.\n\n| Variable name | Description           |\n| ------------- | -------------         |\n| CF_API_TOKEN  | Cloudflare API token  | \n| CF_ACCOUNT_ID | Can be set either in CI/CD variable or in your `wrangler.toml` |\n| CF_ZONE_ID    | Can be set either in CI/CD variable or in your `wrangler.toml` |\n\n\n`gitlab-wrangler-action` also supports using your [global API key and email](https://developers.cloudflare.com/workers/quickstart/#global-api-key) as an authentication method, although API tokens are preferred. Pass in `CF_API_KEY` and `CF_API_EMAIL` to the CI/CD variables intead.\n\n## Configuration\n\nYou can additionaly set following CI/CD variables, either in repository settings or within the `wrangler deploy` job.\n\n| Variable name         | Description\n| --------------------- | ------------\n| WRANGLER_VERSION      | Use specific Wrangler version\n| WORKING_DIRECTORY     | Folder to run Wrangler commands from \n| ENVIRONMENT           | Wrangler environment to use\n| PUBLISH               | If false, skip Wranger put secrets / deployment, useful for cases to run build only\n| SECRETS               | Secret to create, see example below\n| PRECOMMANDS           | Commands to run before Wrangler deployment, see example below\n| POSTCOMMANDS          | Comamnd to run after Wrangler deployment\n\nThe below example will publish your application on pushes to the `dev` branch to `dev` env, with creation of KV namespace before the deployment:\n\n```yaml\ninclude: \n  - remote: \"https://raw.githubusercontent.com/eidam/gitlab-wrangler-action/main/templates/1.3.0.yml\"\n\nstages:\n  - deploy\n\nwrangler deploy dev:\n  extends: .wrangler_deploy\n  stage: deploy\n  rules:\n    - if: '$CI_COMMIT_BRANCH == \"dev\"'\n  variables:\n    ENVIRONMENT: dev\n    PRECOMMANDS: |\n      wrangler kv:namespace create MY_NAMESPACE || namespace already exists\n```\n\n[Worker secrets](https://developers.cloudflare.com/workers/tooling/wrangler/secrets/) can be optionally passed as a new line deliminated string of names in `secrets`.  Each secret name must match an environment variable name specified in the CI/CD variables. Creates or replaces the value for the Worker secret using the `wrangler secret put` command.\n\n```yaml\ninclude: \n  - remote: \"https://raw.githubusercontent.com/eidam/gitlab-wrangler-action/main/templates/1.3.0.yml\"\n\nstages:\n  - deploy\n\nwrangler deploy:\n  extends: .wrangler_deploy\n  stage: deploy\n  variables:\n    SECRETS: |\n      SECRET_ONE\n      SECRET_TWO\n      SECRET_THREE\n  rules:\n    - if: '$CI_COMMIT_BRANCH == \"master\"'\n```\n\n## Troubleshooting\n\nThis Gitlab CI template is in beta, and I'm looking for folks to use it! If something goes wrong, please file an issue! That being said, there's a couple things you should know:\n\n### \"I just started using Workers/Wrangler and I don't know what this is!\"\n\nNo problem! Check out the [Quick Start guide](https://developers.cloudflare.com/workers/quickstart) in our docs to get started. Once you have a Workers application, you may want to set it up to automatically deploy from Gitlab whenever you change your project. That's where this action comes in - nice!\n\n### \"I'm trying to deploy my static site but it isn't working!\"\n\nTo deploy static sites and frontend applications to Workers, check out the documentation for [Workers Sites](https://developers.cloudflare.com/workers/sites).\n\nNote that this action makes no assumptions about _how_ your project is built! **If you need to run a pre-publish step, like building your application, you need to specify a build step in your Gitlab CI/CD configuration and pass it as for example CI artifacts.**\n\n## Plans / TODO\n\n- host README and templates on Cloudflare Pages\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feidam%2Fgitlab-wrangler-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feidam%2Fgitlab-wrangler-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feidam%2Fgitlab-wrangler-action/lists"}