├── .envrc ├── .github ├── CODE_OF_CONDUCT.md ├── ISSUE_TEMPLATE │ ├── bug_report.md │ └── feature_request.md ├── PULL_REQUEST_TEMPLATE.md └── workflows │ └── example.yml ├── .gitignore ├── LICENSE ├── README.md ├── action.yml ├── dist └── index.js ├── example └── index.html ├── nix ├── sources.json └── sources.nix ├── package-lock.json ├── package.json ├── shell.nix ├── src ├── index.ts ├── installer.ts └── utils.ts └── tsconfig.json /.envrc: -------------------------------------------------------------------------------- 1 | eval "$(lorri direnv)" 2 | -------------------------------------------------------------------------------- /.github/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | ## 1. Purpose 4 | 5 | A primary goal of `FISSON` is to be inclusive to the largest number of contributors, with the most varied and diverse backgrounds possible. As such, we are committed to providing a friendly, safe and welcoming environment for all, regardless of gender, sexual orientation, ability, ethnicity, socioeconomic status, and religion (or lack thereof). 6 | 7 | This code of conduct outlines our expectations for all those who participate in our community, as well as the consequences for unacceptable behavior. 8 | 9 | We invite all those who participate in `FISSION` to help us create safe and positive experiences for everyone. 10 | 11 | ## 2. Open Source Citizenship 12 | 13 | A supplemental goal of this Code of Conduct is to increase open source citizenship by encouraging participants to recognize and strengthen the relationships between our actions and their effects on our community. 14 | 15 | Communities mirror the societies in which they exist and positive action is essential to counteract the many forms of inequality and abuses of power that exist in society. 16 | 17 | If you see someone who is making an extra effort to ensure our community is welcoming, friendly, and encourages all participants to contribute to the fullest extent, we want to know. 18 | 19 | ## 3. Expected Behavior 20 | 21 | The following behaviors are expected and requested of all community members: 22 | 23 | * Participate in an authentic and active way. In doing so, you contribute to the health and longevity of this community. 24 | * Exercise consideration and respect in your speech and actions. 25 | * Attempt collaboration before conflict. 26 | * Refrain from demeaning, discriminatory, or harassing behavior and speech. 27 | * Be mindful of your surroundings and of your fellow participants. Alert community leaders if you notice a dangerous situation, someone in distress, or violations of this Code of Conduct, even if they seem inconsequential. 28 | * Remember that community event venues may be shared with members of the public; please be respectful to all patrons of these locations. 29 | 30 | ## 4. Unacceptable Behavior 31 | 32 | The following behaviors are considered harassment and are unacceptable within our community: 33 | 34 | * Violence, threats of violence or violent language directed against another person. 35 | * Sexist, racist, homophobic, transphobic, ableist or otherwise discriminatory jokes and language. 36 | * Posting or displaying sexually explicit or violent material. 37 | * Posting or threatening to post other people’s personally identifying information ("doxing"). 38 | * Personal insults, particularly those related to gender, sexual orientation, race, religion, or disability. 39 | * Inappropriate photography or recording. 40 | * Inappropriate physical contact. You should have someone’s consent before touching them. 41 | * Unwelcome sexual attention. This includes, sexualized comments or jokes; inappropriate touching, groping, and unwelcomed sexual advances. 42 | * Deliberate intimidation, stalking or following (online or in person). 43 | * Advocating for, or encouraging, any of the above behavior. 44 | * Sustained disruption of community events, including talks and presentations. 45 | 46 | ## 5. Consequences of Unacceptable Behavior 47 | 48 | Unacceptable behavior from any community member, including sponsors and those with decision-making authority, will not be tolerated. 49 | 50 | Anyone asked to stop unacceptable behavior is expected to comply immediately. 51 | 52 | If a community member engages in unacceptable behavior, the community organizers may take any action they deem appropriate, up to and including a temporary ban or permanent expulsion from the community without warning (and without refund in the case of a paid event). 53 | 54 | ## 6. Reporting Guidelines 55 | 56 | If you are subject to or witness unacceptable behavior, or have any other concerns, please notify a community organizer as soon as possible. hello@brooklynzelenka.com. 57 | 58 | 59 | 60 | Additionally, community organizers are available to help community members engage with local law enforcement or to otherwise help those experiencing unacceptable behavior feel safe. In the context of in-person events, organizers will also provide escorts as desired by the person experiencing distress. 61 | 62 | ## 7. Addressing Grievances 63 | 64 | If you feel you have been falsely or unfairly accused of violating this Code of Conduct, you should notify the maintainers with a concise description of your grievance. Your grievance will be handled in accordance with our existing governing policies. 65 | 66 | 67 | 68 | ## 8. Scope 69 | 70 | We expect all community participants (contributors, paid or otherwise; sponsors; and other guests) to abide by this Code of Conduct in all community venues–online and in-person–as well as in all one-on-one communications pertaining to community business. 71 | 72 | This code of conduct and its related procedures also applies to unacceptable behavior occurring outside the scope of community activities when such behavior has the potential to adversely affect the safety and well-being of community members. 73 | 74 | ## 9. Contact info 75 | 76 | hello@fission.codes 77 | 78 | ## 10. License and attribution 79 | 80 | This Code of Conduct is distributed under a [Creative Commons Attribution-ShareAlike license](http://creativecommons.org/licenses/by-sa/3.0/). 81 | 82 | Portions of text derived from the [Django Code of Conduct](https://www.djangoproject.com/conduct/) and the [Geek Feminism Anti-Harassment Policy](http://geekfeminism.wikia.com/wiki/Conference_anti-harassment/Policy). 83 | 84 | Retrieved on November 22, 2016 from [http://citizencodeofconduct.org/](http://citizencodeofconduct.org/) 85 | 86 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: "\U0001F41B bug" 6 | assignees: '' 7 | 8 | --- 9 | 10 | # Summary 11 | 12 | ## Problem 13 | 14 | Describe the immediate problem 15 | 16 | ### Impact 17 | 18 | The impact that this bug has 19 | 20 | ## Solution 21 | 22 | Describe the sort of fix that would solve the issue 23 | 24 | # Detail 25 | 26 | **Describe the bug** 27 | A clear and concise description of what the bug is. 28 | 29 | **To Reproduce** 30 | Steps to reproduce the behavior: 31 | 1. Go to '...' 32 | 2. Click on '....' 33 | 3. Scroll down to '....' 34 | 4. See error 35 | 36 | **Expected behavior** 37 | A clear and concise description of what you expected to happen. 38 | 39 | **Screenshots** 40 | If applicable, add screenshots to help explain your problem. 41 | 42 | **Desktop (please complete the following information):** 43 | - OS: [e.g. iOS] 44 | - Browser [e.g. chrome, safari] 45 | - Version [e.g. 22] 46 | 47 | **Smartphone (please complete the following information):** 48 | - Device: [e.g. iPhone6] 49 | - OS: [e.g. iOS8.1] 50 | - Browser [e.g. stock browser, safari] 51 | - Version [e.g. 22] 52 | 53 | **Additional context** 54 | Add any other context about the problem here. 55 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: "\U0001F497 enhancement" 6 | assignees: '' 7 | 8 | --- 9 | 10 | NB: Feature requests will only be considered if they solve a pain 11 | 12 | # Summary 13 | 14 | ## Problem 15 | 16 | Describe the pain that this feature will solve 17 | 18 | ### Impact 19 | 20 | The impact of not having this feature 21 | 22 | ## Solution 23 | 24 | Describe the solution 25 | 26 | # Detail 27 | 28 | **Is your feature request related to a problem? Please describe.** 29 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 30 | 31 | **Describe the solution you'd like** 32 | A clear and concise description of what you want to happen. 33 | 34 | **Describe alternatives you've considered** 35 | A clear and concise description of any alternative solutions or features you've considered. 36 | 37 | **Additional context** 38 | Add any other context or screenshots about the feature request here. 39 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | A similar PR may already be submitted! 2 | Please search among the [Pull request](../) before creating one. 3 | 4 | Thanks for submitting a pull request! Please provide enough information so that others can review your pull request: 5 | 6 | For more information, see the `CONTRIBUTING` guide. 7 | 8 | 9 | ## Summary 10 | 11 | 12 | This PR fixes/implements the following **bugs/features** 13 | 14 | * [ ] Bug 1 15 | * [ ] Bug 2 16 | * [ ] Feature 1 17 | * [ ] Feature 2 18 | * [ ] Breaking changes 19 | 20 | 21 | 22 | Explain the **motivation** for making this change. What existing problem does the pull request solve? 23 | 24 | 25 | 26 | ## Test plan (required) 27 | 28 | Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. 29 | 30 | 31 | 32 | 33 | ## Closing issues 34 | 35 | 36 | Fixes # 37 | 38 | ## After Merge 39 | * [ ] Does this change invalidate any docs or tutorials? _If so ensure the changes needed are either made or recorded_ 40 | * [ ] Does this change require a release to be made? Is so please create and deploy the release 41 | 42 | -------------------------------------------------------------------------------- /.github/workflows/example.yml: -------------------------------------------------------------------------------- 1 | name: "example" 2 | on: [push] 3 | jobs: 4 | publish: 5 | name: Example Publish 6 | runs-on: ubuntu-latest 7 | steps: 8 | - name: Checkout 9 | uses: actions/checkout@v3 10 | - name: Publish 11 | uses: ./ 12 | with: 13 | machine_key: ${{ secrets.MACHINE_KEY }} 14 | remote: staging 15 | workdir: ./example 16 | app_url: publish.fissionapp.net 17 | verbose: true 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules/ 2 | .secrets -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | Fission logo 3 | 4 |

Publish Action

5 | 6 | [![Built by FISSION](https://img.shields.io/badge/⌘-Built_by_FISSION-purple.svg)](https://fission.codes) 7 | [![Discord](https://img.shields.io/discord/478735028319158273.svg)](https://discord.gg/zAQBDEq) 8 | [![Discourse](https://img.shields.io/discourse/https/talk.fission.codes/topics)](https://talk.fission.codes) 9 |
10 | 11 | This action publishes your app on Fission. 12 | 13 | *Note* You need to have an account already registered. See the [Getting Started](https://guide.fission.codes/developers/getting-started) section of the Fission Guide. 14 | 15 | # QuickStart 16 | 17 | ``` yaml 18 | - uses: fission-suite/publish-action@v1 19 | with: 20 | machine_key: ${{ secrets.FISSION_MACHINE_KEY }} 21 | ``` 22 | 23 | ## Inputs 24 | 25 | ### `machine_key` 26 | 27 | **Required** The base64 encoded "machine key" for the app owner. 28 | 29 | Once your user and app are registered, you can use the following command to get your key (base64 encoded): 30 | 31 | `base64 ~/.config/fission/key/machine_id.ed25519` 32 | 33 | Copy the resulting value into Github Secrets for your project (or run `gh secret set` if using the GitHub CLI). 34 | 35 | *Note* Currently the machine key must come from a root account that was created using the Fission CLI. See Troubleshooting below for more info. 36 | 37 | ### `app_url` 38 | 39 | *Optional* The URL of an already registered app. You can use this option instead of committing your `fission.yaml` file to git. This is especially useful if you want to deploy different branches to different URLs. 40 | 41 | ### `build_dir` 42 | 43 | *Optional* The build output directory for your app. This is the same value as the `build` valid in `fission.yaml`. 44 | 45 | ### `workdir` 46 | 47 | *Optional* Set the working directory for publish. This is only required if your fission.yaml file is not in the root directory for the repository. 48 | 49 | ### `remote` 50 | 51 | *Optional* Set the remote (Fission API endpoint) to use (leave this blank unless you know you need it.). 52 | 53 | ### `verbose` 54 | 55 | *Optional* Enables verbose output from the fission CLI (useful for debugging publishing errors). 56 | 57 | ## Outputs 58 | 59 | ### `app_url` 60 | 61 | The url of the published app - particularly useful if your repository doesn't have a fission.yaml file and you are using generated urls. 62 | 63 | ### `app_cid` 64 | The content identifier of the published app. 65 | 66 | ## Troubleshooting 67 | 68 | ### Invalid key file provided 69 | 70 | When you run your GitHub action, you receive the following error. 71 | 72 | ``` 73 | 🚫 Invalid key file provided. 74 | ``` 75 | 76 | Currently the publish action will only work for machine keys associated with root accounts that were created using the Fission CLI, not a web browser. If you are experiencing this issue, jump into the #support channel in [Discord](https://discord.gg/daDMAjE) and we'll get things squared away for you. 77 | 78 | ### 403 "Resource not accessible by integration" Github API error 79 | 80 | At the Github org level, navigate to `https://github.com/organizations//settings/actions` and ensure `Read and write permissions` is selected: 81 | image 82 | 83 | 84 | -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: "Publish on Fission" 2 | description: "Publish a folder to fission" 3 | author: walkah 4 | inputs: 5 | machine_key: 6 | description: "A base64 encoded machine key for deploying." 7 | required: true 8 | app_url: 9 | description: "The URL of an already fission app." 10 | required: false 11 | build_dir: 12 | description: "The build output directory for fission publish." 13 | required: false 14 | default: "." 15 | workdir: 16 | description: "Working directory where fission commands (publish) should run" 17 | required: false 18 | default: "." 19 | remote: 20 | description: "The remote environment to use for API calls." 21 | required: false 22 | verbose: 23 | description: "Run fission CLI commands in verbose mode (good for debugging)." 24 | required: false 25 | default: "false" 26 | token: 27 | description: "A Github access token." 28 | required: false 29 | default: ${{github.token}} 30 | 31 | outputs: 32 | app_url: 33 | description: "App URL for the published app." 34 | app_cid: 35 | description: "App CID." 36 | runs: 37 | using: "node16" 38 | main: "dist/index.js" 39 | -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Hello, Universe! 4 | 5 | 6 |

Hello, Universe!

7 |

This is a Fission powered page.

8 |

Assisted by Fission.

9 | 10 | 11 | -------------------------------------------------------------------------------- /nix/sources.json: -------------------------------------------------------------------------------- 1 | { 2 | "niv": { 3 | "branch": "master", 4 | "description": "Easy dependency management for Nix projects", 5 | "homepage": "https://github.com/nmattia/niv", 6 | "owner": "nmattia", 7 | "repo": "niv", 8 | "rev": "65a61b147f307d24bfd0a5cd56ce7d7b7cc61d2e", 9 | "sha256": "17mirpsx5wyw262fpsd6n6m47jcgw8k2bwcp1iwdnrlzy4dhcgqh", 10 | "type": "tarball", 11 | "url": "https://github.com/nmattia/niv/archive/65a61b147f307d24bfd0a5cd56ce7d7b7cc61d2e.tar.gz", 12 | "url_template": "https://github.com///archive/.tar.gz" 13 | }, 14 | "nixpkgs": { 15 | "branch": "nixpkgs-unstable", 16 | "description": "Nix Packages collection", 17 | "homepage": "", 18 | "owner": "NixOS", 19 | "repo": "nixpkgs", 20 | "rev": "b5182c214fac1e6db9f28ed8a7cfc2d0c255c763", 21 | "sha256": "1q5pphh16lq7pch0ihad1mr6fll0gf6d1rv9z1wdmlzqlgyq50ix", 22 | "type": "tarball", 23 | "url": "https://github.com/NixOS/nixpkgs/archive/b5182c214fac1e6db9f28ed8a7cfc2d0c255c763.tar.gz", 24 | "url_template": "https://github.com///archive/.tar.gz" 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /nix/sources.nix: -------------------------------------------------------------------------------- 1 | # This file has been generated by Niv. 2 | 3 | let 4 | 5 | # 6 | # The fetchers. fetch_ fetches specs of type . 7 | # 8 | 9 | fetch_file = pkgs: name: spec: 10 | let 11 | name' = sanitizeName name + "-src"; 12 | in 13 | if spec.builtin or true then 14 | builtins_fetchurl { inherit (spec) url sha256; name = name'; } 15 | else 16 | pkgs.fetchurl { inherit (spec) url sha256; name = name'; }; 17 | 18 | fetch_tarball = pkgs: name: spec: 19 | let 20 | name' = sanitizeName name + "-src"; 21 | in 22 | if spec.builtin or true then 23 | builtins_fetchTarball { name = name'; inherit (spec) url sha256; } 24 | else 25 | pkgs.fetchzip { name = name'; inherit (spec) url sha256; }; 26 | 27 | fetch_git = name: spec: 28 | let 29 | ref = 30 | if spec ? ref then spec.ref else 31 | if spec ? branch then "refs/heads/${spec.branch}" else 32 | if spec ? tag then "refs/tags/${spec.tag}" else 33 | abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"; 34 | in 35 | builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }; 36 | 37 | fetch_local = spec: spec.path; 38 | 39 | fetch_builtin-tarball = name: throw 40 | ''[${name}] The niv type "builtin-tarball" is deprecated. You should instead use `builtin = true`. 41 | $ niv modify ${name} -a type=tarball -a builtin=true''; 42 | 43 | fetch_builtin-url = name: throw 44 | ''[${name}] The niv type "builtin-url" will soon be deprecated. You should instead use `builtin = true`. 45 | $ niv modify ${name} -a type=file -a builtin=true''; 46 | 47 | # 48 | # Various helpers 49 | # 50 | 51 | # https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695 52 | sanitizeName = name: 53 | ( 54 | concatMapStrings (s: if builtins.isList s then "-" else s) 55 | ( 56 | builtins.split "[^[:alnum:]+._?=-]+" 57 | ((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name) 58 | ) 59 | ); 60 | 61 | # The set of packages used when specs are fetched using non-builtins. 62 | mkPkgs = sources: system: 63 | let 64 | sourcesNixpkgs = 65 | import (builtins_fetchTarball { inherit (sources.nixpkgs) url sha256; }) { inherit system; }; 66 | hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath; 67 | hasThisAsNixpkgsPath = == ./.; 68 | in 69 | if builtins.hasAttr "nixpkgs" sources 70 | then sourcesNixpkgs 71 | else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then 72 | import {} 73 | else 74 | abort 75 | '' 76 | Please specify either (through -I or NIX_PATH=nixpkgs=...) or 77 | add a package called "nixpkgs" to your sources.json. 78 | ''; 79 | 80 | # The actual fetching function. 81 | fetch = pkgs: name: spec: 82 | 83 | if ! builtins.hasAttr "type" spec then 84 | abort "ERROR: niv spec ${name} does not have a 'type' attribute" 85 | else if spec.type == "file" then fetch_file pkgs name spec 86 | else if spec.type == "tarball" then fetch_tarball pkgs name spec 87 | else if spec.type == "git" then fetch_git name spec 88 | else if spec.type == "local" then fetch_local spec 89 | else if spec.type == "builtin-tarball" then fetch_builtin-tarball name 90 | else if spec.type == "builtin-url" then fetch_builtin-url name 91 | else 92 | abort "ERROR: niv spec ${name} has unknown type ${builtins.toJSON spec.type}"; 93 | 94 | # If the environment variable NIV_OVERRIDE_${name} is set, then use 95 | # the path directly as opposed to the fetched source. 96 | replace = name: drv: 97 | let 98 | saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name; 99 | ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}"; 100 | in 101 | if ersatz == "" then drv else 102 | # this turns the string into an actual Nix path (for both absolute and 103 | # relative paths) 104 | if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}"; 105 | 106 | # Ports of functions for older nix versions 107 | 108 | # a Nix version of mapAttrs if the built-in doesn't exist 109 | mapAttrs = builtins.mapAttrs or ( 110 | f: set: with builtins; 111 | listToAttrs (map (attr: { name = attr; value = f attr set.${attr}; }) (attrNames set)) 112 | ); 113 | 114 | # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295 115 | range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1); 116 | 117 | # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257 118 | stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1)); 119 | 120 | # https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L269 121 | stringAsChars = f: s: concatStrings (map f (stringToCharacters s)); 122 | concatMapStrings = f: list: concatStrings (map f list); 123 | concatStrings = builtins.concatStringsSep ""; 124 | 125 | # https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331 126 | optionalAttrs = cond: as: if cond then as else {}; 127 | 128 | # fetchTarball version that is compatible between all the versions of Nix 129 | builtins_fetchTarball = { url, name ? null, sha256 }@attrs: 130 | let 131 | inherit (builtins) lessThan nixVersion fetchTarball; 132 | in 133 | if lessThan nixVersion "1.12" then 134 | fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) 135 | else 136 | fetchTarball attrs; 137 | 138 | # fetchurl version that is compatible between all the versions of Nix 139 | builtins_fetchurl = { url, name ? null, sha256 }@attrs: 140 | let 141 | inherit (builtins) lessThan nixVersion fetchurl; 142 | in 143 | if lessThan nixVersion "1.12" then 144 | fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; })) 145 | else 146 | fetchurl attrs; 147 | 148 | # Create the final "sources" from the config 149 | mkSources = config: 150 | mapAttrs ( 151 | name: spec: 152 | if builtins.hasAttr "outPath" spec 153 | then abort 154 | "The values in sources.json should not have an 'outPath' attribute" 155 | else 156 | spec // { outPath = replace name (fetch config.pkgs name spec); } 157 | ) config.sources; 158 | 159 | # The "config" used by the fetchers 160 | mkConfig = 161 | { sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null 162 | , sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile) 163 | , system ? builtins.currentSystem 164 | , pkgs ? mkPkgs sources system 165 | }: rec { 166 | # The sources, i.e. the attribute set of spec name to spec 167 | inherit sources; 168 | 169 | # The "pkgs" (evaluated nixpkgs) to use for e.g. non-builtin fetchers 170 | inherit pkgs; 171 | }; 172 | 173 | in 174 | mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); } 175 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "publish-action", 3 | "version": "1.2.8", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "publish-action", 9 | "version": "1.2.8", 10 | "license": "MIT", 11 | "dependencies": { 12 | "@actions/core": "^1.10.0", 13 | "@actions/exec": "^1.1.1", 14 | "@actions/github": "^5.1.1", 15 | "@actions/tool-cache": "^2.0.0", 16 | "yaml": "^2.2.2" 17 | }, 18 | "devDependencies": { 19 | "@types/node": "^16.18.13", 20 | "@vercel/ncc": "^0.36.1", 21 | "typescript": "^4.9.5" 22 | } 23 | }, 24 | "node_modules/@actions/core": { 25 | "version": "1.10.0", 26 | "resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz", 27 | "integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==", 28 | "dependencies": { 29 | "@actions/http-client": "^2.0.1", 30 | "uuid": "^8.3.2" 31 | } 32 | }, 33 | "node_modules/@actions/exec": { 34 | "version": "1.1.1", 35 | "resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz", 36 | "integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==", 37 | "dependencies": { 38 | "@actions/io": "^1.0.1" 39 | } 40 | }, 41 | "node_modules/@actions/github": { 42 | "version": "5.1.1", 43 | "resolved": "https://registry.npmjs.org/@actions/github/-/github-5.1.1.tgz", 44 | "integrity": "sha512-Nk59rMDoJaV+mHCOJPXuvB1zIbomlKS0dmSIqPGxd0enAXBnOfn4VWF+CGtRCwXZG9Epa54tZA7VIRlJDS8A6g==", 45 | "dependencies": { 46 | "@actions/http-client": "^2.0.1", 47 | "@octokit/core": "^3.6.0", 48 | "@octokit/plugin-paginate-rest": "^2.17.0", 49 | "@octokit/plugin-rest-endpoint-methods": "^5.13.0" 50 | } 51 | }, 52 | "node_modules/@actions/http-client": { 53 | "version": "2.0.1", 54 | "resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz", 55 | "integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==", 56 | "dependencies": { 57 | "tunnel": "^0.0.6" 58 | } 59 | }, 60 | "node_modules/@actions/io": { 61 | "version": "1.1.2", 62 | "resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.2.tgz", 63 | "integrity": "sha512-d+RwPlMp+2qmBfeLYPLXuSRykDIFEwdTA0MMxzS9kh4kvP1ftrc/9fzy6pX6qAjthdXruHQ6/6kjT/DNo5ALuw==" 64 | }, 65 | "node_modules/@actions/tool-cache": { 66 | "version": "2.0.1", 67 | "resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-2.0.1.tgz", 68 | "integrity": "sha512-iPU+mNwrbA8jodY8eyo/0S/QqCKDajiR8OxWTnSk/SnYg0sj8Hp4QcUEVC1YFpHWXtrfbQrE13Jz4k4HXJQKcA==", 69 | "dependencies": { 70 | "@actions/core": "^1.2.6", 71 | "@actions/exec": "^1.0.0", 72 | "@actions/http-client": "^2.0.1", 73 | "@actions/io": "^1.1.1", 74 | "semver": "^6.1.0", 75 | "uuid": "^3.3.2" 76 | } 77 | }, 78 | "node_modules/@actions/tool-cache/node_modules/uuid": { 79 | "version": "3.4.0", 80 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", 81 | "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", 82 | "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", 83 | "bin": { 84 | "uuid": "bin/uuid" 85 | } 86 | }, 87 | "node_modules/@octokit/auth-token": { 88 | "version": "2.5.0", 89 | "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-2.5.0.tgz", 90 | "integrity": "sha512-r5FVUJCOLl19AxiuZD2VRZ/ORjp/4IN98Of6YJoJOkY75CIBuYfmiNHGrDwXr+aLGG55igl9QrxX3hbiXlLb+g==", 91 | "dependencies": { 92 | "@octokit/types": "^6.0.3" 93 | } 94 | }, 95 | "node_modules/@octokit/core": { 96 | "version": "3.6.0", 97 | "resolved": "https://registry.npmjs.org/@octokit/core/-/core-3.6.0.tgz", 98 | "integrity": "sha512-7RKRKuA4xTjMhY+eG3jthb3hlZCsOwg3rztWh75Xc+ShDWOfDDATWbeZpAHBNRpm4Tv9WgBMOy1zEJYXG6NJ7Q==", 99 | "dependencies": { 100 | "@octokit/auth-token": "^2.4.4", 101 | "@octokit/graphql": "^4.5.8", 102 | "@octokit/request": "^5.6.3", 103 | "@octokit/request-error": "^2.0.5", 104 | "@octokit/types": "^6.0.3", 105 | "before-after-hook": "^2.2.0", 106 | "universal-user-agent": "^6.0.0" 107 | } 108 | }, 109 | "node_modules/@octokit/endpoint": { 110 | "version": "6.0.12", 111 | "resolved": "https://registry.npmjs.org/@octokit/endpoint/-/endpoint-6.0.12.tgz", 112 | "integrity": "sha512-lF3puPwkQWGfkMClXb4k/eUT/nZKQfxinRWJrdZaJO85Dqwo/G0yOC434Jr2ojwafWJMYqFGFa5ms4jJUgujdA==", 113 | "dependencies": { 114 | "@octokit/types": "^6.0.3", 115 | "is-plain-object": "^5.0.0", 116 | "universal-user-agent": "^6.0.0" 117 | } 118 | }, 119 | "node_modules/@octokit/graphql": { 120 | "version": "4.8.0", 121 | "resolved": "https://registry.npmjs.org/@octokit/graphql/-/graphql-4.8.0.tgz", 122 | "integrity": "sha512-0gv+qLSBLKF0z8TKaSKTsS39scVKF9dbMxJpj3U0vC7wjNWFuIpL/z76Qe2fiuCbDRcJSavkXsVtMS6/dtQQsg==", 123 | "dependencies": { 124 | "@octokit/request": "^5.6.0", 125 | "@octokit/types": "^6.0.3", 126 | "universal-user-agent": "^6.0.0" 127 | } 128 | }, 129 | "node_modules/@octokit/openapi-types": { 130 | "version": "12.11.0", 131 | "resolved": "https://registry.npmjs.org/@octokit/openapi-types/-/openapi-types-12.11.0.tgz", 132 | "integrity": "sha512-VsXyi8peyRq9PqIz/tpqiL2w3w80OgVMwBHltTml3LmVvXiphgeqmY9mvBw9Wu7e0QWk/fqD37ux8yP5uVekyQ==" 133 | }, 134 | "node_modules/@octokit/plugin-paginate-rest": { 135 | "version": "2.21.3", 136 | "resolved": "https://registry.npmjs.org/@octokit/plugin-paginate-rest/-/plugin-paginate-rest-2.21.3.tgz", 137 | "integrity": "sha512-aCZTEf0y2h3OLbrgKkrfFdjRL6eSOo8komneVQJnYecAxIej7Bafor2xhuDJOIFau4pk0i/P28/XgtbyPF0ZHw==", 138 | "dependencies": { 139 | "@octokit/types": "^6.40.0" 140 | }, 141 | "peerDependencies": { 142 | "@octokit/core": ">=2" 143 | } 144 | }, 145 | "node_modules/@octokit/plugin-rest-endpoint-methods": { 146 | "version": "5.16.2", 147 | "resolved": "https://registry.npmjs.org/@octokit/plugin-rest-endpoint-methods/-/plugin-rest-endpoint-methods-5.16.2.tgz", 148 | "integrity": "sha512-8QFz29Fg5jDuTPXVtey05BLm7OB+M8fnvE64RNegzX7U+5NUXcOcnpTIK0YfSHBg8gYd0oxIq3IZTe9SfPZiRw==", 149 | "dependencies": { 150 | "@octokit/types": "^6.39.0", 151 | "deprecation": "^2.3.1" 152 | }, 153 | "peerDependencies": { 154 | "@octokit/core": ">=3" 155 | } 156 | }, 157 | "node_modules/@octokit/request": { 158 | "version": "5.6.3", 159 | "resolved": "https://registry.npmjs.org/@octokit/request/-/request-5.6.3.tgz", 160 | "integrity": "sha512-bFJl0I1KVc9jYTe9tdGGpAMPy32dLBXXo1dS/YwSCTL/2nd9XeHsY616RE3HPXDVk+a+dBuzyz5YdlXwcDTr2A==", 161 | "dependencies": { 162 | "@octokit/endpoint": "^6.0.1", 163 | "@octokit/request-error": "^2.1.0", 164 | "@octokit/types": "^6.16.1", 165 | "is-plain-object": "^5.0.0", 166 | "node-fetch": "^2.6.7", 167 | "universal-user-agent": "^6.0.0" 168 | } 169 | }, 170 | "node_modules/@octokit/request-error": { 171 | "version": "2.1.0", 172 | "resolved": "https://registry.npmjs.org/@octokit/request-error/-/request-error-2.1.0.tgz", 173 | "integrity": "sha512-1VIvgXxs9WHSjicsRwq8PlR2LR2x6DwsJAaFgzdi0JfJoGSO8mYI/cHJQ+9FbN21aa+DrgNLnwObmyeSC8Rmpg==", 174 | "dependencies": { 175 | "@octokit/types": "^6.0.3", 176 | "deprecation": "^2.0.0", 177 | "once": "^1.4.0" 178 | } 179 | }, 180 | "node_modules/@octokit/types": { 181 | "version": "6.41.0", 182 | "resolved": "https://registry.npmjs.org/@octokit/types/-/types-6.41.0.tgz", 183 | "integrity": "sha512-eJ2jbzjdijiL3B4PrSQaSjuF2sPEQPVCPzBvTHJD9Nz+9dw2SGH4K4xeQJ77YfTq5bRQ+bD8wT11JbeDPmxmGg==", 184 | "dependencies": { 185 | "@octokit/openapi-types": "^12.11.0" 186 | } 187 | }, 188 | "node_modules/@types/node": { 189 | "version": "16.18.13", 190 | "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.13.tgz", 191 | "integrity": "sha512-l0/3XZ153UTlNOnZK8xSNoJlQda9/WnYgiTdcKKPJSZjdjI9MU+A9oMXOesAWLSnqAaaJhj3qfQsU07Dr8OUwg==", 192 | "dev": true 193 | }, 194 | "node_modules/@vercel/ncc": { 195 | "version": "0.36.1", 196 | "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.36.1.tgz", 197 | "integrity": "sha512-S4cL7Taa9yb5qbv+6wLgiKVZ03Qfkc4jGRuiUQMQ8HGBD5pcNRnHeYM33zBvJE4/zJGjJJ8GScB+WmTsn9mORw==", 198 | "dev": true, 199 | "bin": { 200 | "ncc": "dist/ncc/cli.js" 201 | } 202 | }, 203 | "node_modules/before-after-hook": { 204 | "version": "2.2.3", 205 | "resolved": "https://registry.npmjs.org/before-after-hook/-/before-after-hook-2.2.3.tgz", 206 | "integrity": "sha512-NzUnlZexiaH/46WDhANlyR2bXRopNg4F/zuSA3OpZnllCUgRaOF2znDioDWrmbNVsuZk6l9pMquQB38cfBZwkQ==" 207 | }, 208 | "node_modules/deprecation": { 209 | "version": "2.3.1", 210 | "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", 211 | "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" 212 | }, 213 | "node_modules/is-plain-object": { 214 | "version": "5.0.0", 215 | "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-5.0.0.tgz", 216 | "integrity": "sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==", 217 | "engines": { 218 | "node": ">=0.10.0" 219 | } 220 | }, 221 | "node_modules/node-fetch": { 222 | "version": "2.6.9", 223 | "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.9.tgz", 224 | "integrity": "sha512-DJm/CJkZkRjKKj4Zi4BsKVZh3ValV5IR5s7LVZnW+6YMh0W1BfNA8XSs6DLMGYlId5F3KnA70uu2qepcR08Qqg==", 225 | "dependencies": { 226 | "whatwg-url": "^5.0.0" 227 | }, 228 | "engines": { 229 | "node": "4.x || >=6.0.0" 230 | }, 231 | "peerDependencies": { 232 | "encoding": "^0.1.0" 233 | }, 234 | "peerDependenciesMeta": { 235 | "encoding": { 236 | "optional": true 237 | } 238 | } 239 | }, 240 | "node_modules/once": { 241 | "version": "1.4.0", 242 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 243 | "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", 244 | "dependencies": { 245 | "wrappy": "1" 246 | } 247 | }, 248 | "node_modules/semver": { 249 | "version": "6.3.0", 250 | "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", 251 | "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", 252 | "bin": { 253 | "semver": "bin/semver.js" 254 | } 255 | }, 256 | "node_modules/tr46": { 257 | "version": "0.0.3", 258 | "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", 259 | "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" 260 | }, 261 | "node_modules/tunnel": { 262 | "version": "0.0.6", 263 | "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", 264 | "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", 265 | "engines": { 266 | "node": ">=0.6.11 <=0.7.0 || >=0.7.3" 267 | } 268 | }, 269 | "node_modules/typescript": { 270 | "version": "4.9.5", 271 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 272 | "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 273 | "dev": true, 274 | "bin": { 275 | "tsc": "bin/tsc", 276 | "tsserver": "bin/tsserver" 277 | }, 278 | "engines": { 279 | "node": ">=4.2.0" 280 | } 281 | }, 282 | "node_modules/universal-user-agent": { 283 | "version": "6.0.0", 284 | "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.0.tgz", 285 | "integrity": "sha512-isyNax3wXoKaulPDZWHQqbmIx1k2tb9fb3GGDBRxCscfYV2Ch7WxPArBsFEG8s/safwXTT7H4QGhaIkTp9447w==" 286 | }, 287 | "node_modules/uuid": { 288 | "version": "8.3.2", 289 | "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", 290 | "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", 291 | "bin": { 292 | "uuid": "dist/bin/uuid" 293 | } 294 | }, 295 | "node_modules/webidl-conversions": { 296 | "version": "3.0.1", 297 | "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", 298 | "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" 299 | }, 300 | "node_modules/whatwg-url": { 301 | "version": "5.0.0", 302 | "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", 303 | "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", 304 | "dependencies": { 305 | "tr46": "~0.0.3", 306 | "webidl-conversions": "^3.0.0" 307 | } 308 | }, 309 | "node_modules/wrappy": { 310 | "version": "1.0.2", 311 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 312 | "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" 313 | }, 314 | "node_modules/yaml": { 315 | "version": "2.2.2", 316 | "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.2.2.tgz", 317 | "integrity": "sha512-CBKFWExMn46Foo4cldiChEzn7S7SRV+wqiluAb6xmueD/fGyRHIhX8m14vVGgeFWjN540nKCNVj6P21eQjgTuA==", 318 | "engines": { 319 | "node": ">= 14" 320 | } 321 | } 322 | } 323 | } 324 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "publish-action", 3 | "version": "1.2.8", 4 | "private": true, 5 | "description": "Publish to Fission", 6 | "main": "lib/index.js", 7 | "scripts": { 8 | "build": "ncc build src/index.ts", 9 | "test": "jest" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/fission-suite/publish-action.git" 14 | }, 15 | "keywords": [ 16 | "actions", 17 | "ipfs" 18 | ], 19 | "author": "James Walker { 14 | try { 15 | statusUpdate("pending"); 16 | const machineKey = core.getInput("MACHINE_KEY", { required: true }); 17 | 18 | await installer.getFissionCLI(); 19 | await installer.importKey(machineKey); 20 | 21 | const workingDir = core.getInput("WORKDIR"); 22 | if (workingDir) { 23 | process.chdir(workingDir); 24 | } 25 | 26 | let config: FissionConfig; 27 | const configPath = path.join(process.cwd(), "fission.yaml"); 28 | const appURL = core.getInput("APP_URL"); 29 | const buildDir = core.getInput("BUILD_DIR"); 30 | if (!fs.existsSync(configPath)) { 31 | if (appURL) { 32 | fs.writeFileSync( 33 | configPath, 34 | YAML.stringify({ url: appURL, build: buildDir }) 35 | ); 36 | } else { 37 | await runFission(["app", "register"]); 38 | } 39 | } else if (appURL) { 40 | // Override the app url (even though fission.yaml exists). 41 | const file = fs.readFileSync(configPath, "utf8"); 42 | config = YAML.parse(file); 43 | config.url = appURL; 44 | fs.writeFileSync(configPath, YAML.stringify(config)); 45 | } 46 | 47 | await runFission(["app", "publish"]); 48 | 49 | const file = fs.readFileSync(configPath, "utf8"); 50 | config = YAML.parse(file); 51 | await statusUpdate("success", `https://${config.url}/`); 52 | core.setOutput("app_url", config.url); 53 | } catch (error) { 54 | let errorMessage = "failed to publish"; 55 | if (error instanceof Error && error.message) { 56 | errorMessage = error.message; 57 | } 58 | await statusUpdate("failure"); 59 | core.setFailed(errorMessage); 60 | } 61 | }; 62 | 63 | run(); 64 | -------------------------------------------------------------------------------- /src/installer.ts: -------------------------------------------------------------------------------- 1 | import * as core from "@actions/core"; 2 | import * as exec from "@actions/exec"; 3 | import * as github from "@actions/github"; 4 | import * as tc from "@actions/tool-cache"; 5 | import * as assert from "assert"; 6 | import * as fs from "fs"; 7 | import * as path from "path"; 8 | import { runFission } from "./utils"; 9 | 10 | const ASSET_NAME = "fission-cli-ubuntu-20.04-x86_64"; 11 | 12 | export const getFissionCLI = async () => { 13 | const githubToken = core.getInput("token"); 14 | const octokit = github.getOctokit(githubToken); 15 | 16 | // Grab the latest release from github 17 | const { data: release } = await octokit.rest.repos.getLatestRelease({ 18 | owner: "fission-suite", 19 | repo: "fission", 20 | }); 21 | 22 | core.info(`Using fission CLI version: ${release.tag_name}`); 23 | 24 | // Check the tool cache for the fission CLI. 25 | let toolPath: string; 26 | toolPath = tc.find("fission-cli", release.tag_name); 27 | if (!toolPath) { 28 | // Get the URL for the actual CLI version 29 | let downloadPath = ""; 30 | const asset = release.assets.find((a) => a.name == ASSET_NAME); 31 | if (asset) { 32 | downloadPath = await tc.downloadTool(asset.browser_download_url); 33 | await exec.exec("chmod", ["+x", downloadPath]); 34 | } else { 35 | core.info("Unable to find release download."); 36 | } 37 | 38 | if (downloadPath) { 39 | toolPath = await tc.cacheFile( 40 | downloadPath, 41 | "fission", 42 | "fission-cli", 43 | release.tag_name 44 | ); 45 | } 46 | } 47 | 48 | core.addPath(toolPath); 49 | }; 50 | 51 | export const importKey = async (key: string) => { 52 | const tempDir = process.env["RUNNER_TEMP"] || ""; 53 | assert.ok(tempDir, "Expected RUNNER_TEMP to be defined"); 54 | 55 | const keyFile = path.join(tempDir, "machine_id.ed25519"); 56 | 57 | let buff = Buffer.from(key, "base64"); 58 | fs.writeFileSync(keyFile, buff); 59 | 60 | await runFission(["setup", "--with-key", keyFile]); 61 | }; 62 | -------------------------------------------------------------------------------- /src/utils.ts: -------------------------------------------------------------------------------- 1 | import * as core from "@actions/core"; 2 | import * as exec from "@actions/exec"; 3 | import * as github from "@actions/github"; 4 | 5 | export const runFission = async (opts: Array) => { 6 | let defaultOpts: Array = []; 7 | const remote = core.getInput("REMOTE"); 8 | if (remote) { 9 | defaultOpts.push(`-R ${remote}`); 10 | } 11 | 12 | const verbose = core.getBooleanInput("VERBOSE"); 13 | 14 | // We need to pass --verbose to fission app publish to get the CID 15 | defaultOpts.push("--verbose"); 16 | 17 | const execOptions: exec.ExecOptions = { 18 | // Makes the actions silent by default, but we can override this with the listener below 19 | silent: true, 20 | } 21 | 22 | let cid: string | undefined = undefined; 23 | 24 | execOptions.listeners = { 25 | stdline(data) { 26 | console.log(data) 27 | }, 28 | 29 | errline: (data: string) => { 30 | if(verbose) { 31 | console.log(data) 32 | } 33 | 34 | const regex = /Directory CID is (.+)/ 35 | const match = data.match(regex); 36 | 37 | if (match) { 38 | cid = match[1] 39 | } 40 | } 41 | } 42 | 43 | const options = opts.concat(defaultOpts); 44 | await exec.exec("fission", options, execOptions); 45 | if(cid) { 46 | core.setOutput('app_cid', cid) 47 | console.log(`🌐 https://dweb.link/ipfs/${cid}`) 48 | } 49 | }; 50 | 51 | export const statusUpdate = async ( 52 | state: "pending" | "success" | "failure", 53 | target_url: string = "" 54 | ) => { 55 | const githubToken = core.getInput("token"); 56 | const octokit = github.getOctokit(githubToken); 57 | const context = github.context; 58 | 59 | let description = ""; 60 | switch (state) { 61 | case "pending": 62 | description = "Working..."; 63 | break; 64 | case "success": 65 | description = "Success!"; 66 | break; 67 | case "failure": 68 | description = "Failed."; 69 | break; 70 | } 71 | 72 | await octokit.rest.repos.createCommitStatus({ 73 | ...context.repo, 74 | sha: context.sha, 75 | state, 76 | target_url, 77 | description, 78 | context: "Publish to Fission", 79 | }); 80 | }; 81 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "lib": [ 6 | "es6" 7 | ], 8 | "outDir": "./lib", 9 | "rootDir": "./src", 10 | "sourceMap": true, 11 | "strict": true, 12 | "noImplicitAny": false, 13 | "esModuleInterop": true 14 | }, 15 | "exclude": ["__tests__", "lib", "node_modules"] 16 | } --------------------------------------------------------------------------------