{"id":19032544,"url":"https://github.com/storacha/add-to-web3","last_synced_at":"2025-04-09T14:06:20.245Z","repository":{"id":37824172,"uuid":"386612877","full_name":"storacha/add-to-web3","owner":"storacha","description":"⁂ Github Action to upload files to web3.storage","archived":false,"fork":false,"pushed_at":"2025-01-24T12:02:33.000Z","size":499,"stargazers_count":53,"open_issues_count":5,"forks_count":31,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-02T12:05:41.479Z","etag":null,"topics":["deploy","filecoin","ipfs","web3"],"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/storacha.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-16T11:27:09.000Z","updated_at":"2025-03-22T12:44:40.000Z","dependencies_parsed_at":"2024-09-10T13:09:16.347Z","dependency_job_id":"12b2cdc1-ce25-4ea9-b152-1ef1ae4636a5","html_url":"https://github.com/storacha/add-to-web3","commit_stats":{"total_commits":11,"total_committers":5,"mean_commits":2.2,"dds":0.6363636363636364,"last_synced_commit":"59774ff5ca3e7fd57fbd25ad62557a408a6122fc"},"previous_names":["storacha/add-to-web3","web3-storage/add-to-web3"],"tags_count":8,"template":false,"template_full_name":"actions/javascript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storacha%2Fadd-to-web3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storacha%2Fadd-to-web3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storacha%2Fadd-to-web3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/storacha%2Fadd-to-web3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/storacha","download_url":"https://codeload.github.com/storacha/add-to-web3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248054231,"owners_count":21039952,"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":["deploy","filecoin","ipfs","web3"],"created_at":"2024-11-08T21:29:14.554Z","updated_at":"2025-04-09T14:06:20.210Z","avatar_url":"https://github.com/storacha.png","language":null,"funding_links":[],"categories":["Others"],"sub_categories":[],"readme":"# add-to-web3\n\nUpload files to [web3.storage](https://web3.storage) from a Github Action, and output the IPFS Content ID.\n\nA lightweight wrapper around [w3cli]. As a [composite](https://docs.github.com/en/actions/creating-actions/creating-a-composite-action) github action all it does is configure and call the cli for you. See the steps in [./action.yml](./action.yml).\n\n## Usage\n\n```yaml\nuses: web3-storage/add-to-web3@v3\nid: w3up\nwith:\n  path_to_add: 'dist'\n  proof: ${{ secrets.W3_PROOF }}\n  secret_key: ${{ secrets.W3_PRINCIPAL }}\n\n# use the outputs in subsequent steps\n# \"bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am\"\n- run: echo ${{ steps.w3up.outputs.cid }}\n\n# \"https://bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am.ipfs.w3s.link\"\n- run: echo ${{ steps.w3up.outputs.url }}\n```\n\n### Generating a `secret_key` and `proof`\n\nOn your dev machine, use [w3cli] to generate a `secret_key` and `proof` to allow this action to upload to a space.\n\nInstall it from npm and login as described here https://web3.storage/docs/quickstart/ then create a key like this:\n\n```shell\n# Use the `did` in the input to the next command. \n# Use `key` as your `secret_key` for add_to_web3.\n$ w3 key create --json\n{\n  \"did\": \"did:key:z6Mk...\",\n  \"key\": \"MgCaT7Se2QX9...\"\n}\n```\n\nKeep the `key` safe. Save it as a secret on your repo.\n\nCopy the `did` for use in the next command. The output is a base64 encoded ucan `proof` that delegates capabilities to `space/blob/add`, `space/index/add`, `filecoin/offer`, and `upload/add` on your current space to the key generated above.\n\n```shell\n# Delegate capabilities to the `did` we created above.\n$ w3 delegation create did:key:z6Mk... -c space/blob/add -c space/index/add -c filecoin/offer -c upload/add --base64\nmAYIEAP8OEaJlcm9vdHOAZ3ZlcnNpb24BwwUBcRIg+oHTbzShh1WzBo9ISkonCW+KAcy/+zW8Zb...\n```\n\nThe capabilies `space/blob/add`, `space/index/add`, `filecoin/offer`, and `upload/add` are the minimum required to upload files to web3.storage. This proof will not allow that key to list uploads in this space for example.\n\nTo recap:\n\n- Use the `key` value from the output of `w3 key create --json` as the `secret_key` for this action.\n- Use the `did` value from that output as the audience for `w3 delegation create \u003caudience\u003e` shown above.\n- Use the output of `w3 delegation create \u003caudience\u003e --base64` as the `proof` for this action.\n\n## Inputs\n\n### `path_to_add`\n\n**Required** The path the root directory of your static website or other content that you want to publish to IPFS.\n\n### `secret_key`\n\n**Required** The base64 encoded key to use to sign UCAN invocations to web3.storage. \n\nCreate one using `w3 key create`. See: https://github.com/web3-storage/w3cli#w3_principal\n\n### `proof`\n\n**Required** A base64 encoded UCAN delegating capabilities the signing key above. \n\nCreate a proof using w3cli, delegating `space/blob/add`, `space/index/add`, `filecoin/offer`, and `upload/add`\n\n```shell\n$ AUDIENCE_DID=\"\u003cthe DID for secret_key created by `w3 key create`\u003e\"\n$ w3 delegation create $AUDIENCE_DID  -c space/blob/add -c space/index/add -c filecoin/offer -c upload/add --base64`\n```\n\n\u003cdetails\u003e\n  \u003csummary\u003eShow advanced options: \u003ccode\u003ehidden\u003c/code\u003e, \u003ccode\u003ewrap\u003c/code\u003e\u003c/summary\u003e\n\n### `hidden`\n\n_Default_ `false`\n\nShould hidden files prefixed with a `.` be included when found in the `path_to_add`\n\nsee: See: https://github.com/web3-storage/w3cli#w3-up-path-path\n\n### `wrap`\n\n_Default_ `true`\n\nIf `path_to_add` points to a file it will be wrapped in a directory to preserve the filename. To disable that set wrap: \"true\".\n\nSee: https://github.com/web3-storage/w3cli#w3-up-path-path\n\n\u003c/details\u003e\n\n## Outputs\n\n### `cid`\n\nThe IPFS content ID for the directory on IPFS. \ne.g. `bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am`\n\n### `url`\n\nThe IPFS gateway URL for the directory \ne.g. `https://dweb.link/ipfs/bafkreicysg23kiwv34eg2d7qweipxwosdo2py4ldv42nbauguluen5v6am`\n\n## Contributing\n\n💌 Considerate contributions welcome! \n\n\u003ch3 align=\"center\"\u003e\u003ca href=\"https://web3.storage\"\u003e⁂\u003c/a\u003e\u003c/h3\u003e\n\n[w3cli]: https://github.com/web3-storage/w3cli\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoracha%2Fadd-to-web3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoracha%2Fadd-to-web3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoracha%2Fadd-to-web3/lists"}