1
0
mirror of synced 2026-01-08 21:02:10 -05:00
Files
docs/content/packages/quickstart.md
jmarlena 0a4f3e7dab Self-serve package deletion and restoration (#17695)
* New article title & reposition article

* Update links

* Remove "Deleting a container image" article

* Reusable shuffle

* Add GHES versioned article

* more context

* Revise main article

* Reminder of permissions

* Update some copy

* Add "deleting a package" to TOC

* Add versioning around links

* Update restore package procedure

* Update permissions statements

* Fix GHES link

* Apply suggestions from code review

Co-authored-by: Martin Lopes <martin389@github.com>

* Use "entire" language

* GraphQL nuance

* New intro + actions

* Fix GHES link

* Package deletion 2.0 follow up (#17855)

* Remove GHES 3.1 versioning

* 3.0 or less

* Revert "Remove GHES 3.1 versioning"

This reverts commit 9bbc0bd57c1c7ba23097f3f4b9a830c13941402c.

* Revert "3.0 or less"

This reverts commit dfd2f48e4a4da62c2594fbeaeb12eacda5afc6d4.

* Revert "Revert "Remove GHES 3.1 versioning""

This reverts commit ef90065eb2883041b15bd2d50f97e4f07cf04768.

* Ditch unnecessary package namespace references and rework permissions framing

* Add placeholder note so PR tests will pass

* Add versioning around package deletion mentions outside of main deletion articles

* Add placeholder around link so it will go live

* Add `audit_log` entries

* Apply suggestions from code review

Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>

* Apply Shati's suggestion

* Remove duplicate line

Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>

* Package deletion 2.0 last updates (#17880)

* Update versioning and placeholder note

* syntax improvement

* Note the 25 downloads caveat

* Add more headings

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Sarah Edwards <skedwards88@github.com>

* Apply suggestions from code review

* Apply suggestions from code review

* Packages REST API page (#17808)

* Add draft of packages REST page

* Add packages in TOC

* Rewrite Packages API introductory info

* Fix space

* Rewrite conceptual API intro content

* Revise this line

* Apply suggestions from code review

* Apply suggestions from code review

* Apply suggestions from code review

Co-authored-by: Mark Phelps <markphelps@github.com>

* Add rewrite

* Add de dereferenced files

* Add the decorated files

* ALL of the decorated files

* Revert "ALL of the decorated files"

This reverts commit 38f13dcd75078f2eacb53dfd0b31c79737966656.

* Revert "Add the decorated files"

This reverts commit b0c8a2096c8b19e62404585f97298ab42822d3e5.

* Revert "Add de dereferenced files"

This reverts commit abd377c8eb804e9c69dffa9b0c01ec64fb500727.

* Commit the lib/rest/static files to preview changes on staging

* Revert "Commit the lib/rest/static files to preview changes on staging"

This reverts commit acb121ae9d8bd2e23b00ebb14848e7b83aeddf5b.

Co-authored-by: Mark Phelps <markphelps@github.com>

* Commit static files to preview endpoints on staging

* Update references to API support

* remove static rest api files

* ditch "as a user" for now

* Rearrange based on feedback

* Last tidbits

* Update OpenAPI Descriptions (#17893)

* Update OpenAPI Descriptions

* Add decorated OpenAPI schema files

* link fix

Co-authored-by: Martin Lopes <martin389@github.com>
Co-authored-by: Shati Patel <42641846+shati-patel@users.noreply.github.com>
Co-authored-by: Sarah Edwards <skedwards88@github.com>
Co-authored-by: Mark Phelps <markphelps@github.com>
Co-authored-by: github-openapi-bot <69533958+github-openapi-bot@users.noreply.github.com>
2021-02-17 17:02:10 -08:00

5.6 KiB
Raw Blame History

title, intro, allowTitleToDifferFromFilename, versions
title intro allowTitleToDifferFromFilename versions
Quickstart for GitHub Packages Publish to {% data variables.product.prodname_registry %} in 5 minutes or less with {% data variables.product.prodname_actions %}. true
free-pro-team enterprise-server
* >=2.22

Introduction

You only need an existing {% data variables.product.prodname_dotcom %} repository to publish a package to {% data variables.product.prodname_registry %}. In this guide, you'll create a {% data variables.product.prodname_actions %} workflow to test your code and then publish it to {% data variables.product.prodname_registry %}. Feel free to create a new repository for this Quickstart. You can use it to test this and future {% data variables.product.prodname_actions %} workflows.

Publishing your package

  1. Create a new repository on {% data variables.product.prodname_dotcom %}, adding the .gitignore for Node. {% if currentVersion ver_lt "enterprise-server@3.1" %} Create a private repository if youd like to delete this package later, public packages cannot be deleted.{% endif %} For more information, see "Creating a new repository."
  2. Clone the repository to your local machine. {% raw %}
    $ git clone https://github.com/<em>YOUR-USERNAME</em>/<em>YOUR-REPOSITORY</em>.git
    $ cd <em>YOUR-REPOSITORY</em>
    
    {% endraw %}
  3. Create an index.js file and add a basic alert to say "Hello world!" {% raw %}
    alert("Hello, World!");
    
    {% endraw %}
  4. Initialize an npm package. In the package initialization wizard, enter your package with the name: @YOUR-USERNAME/YOUR-REPOSITORY, and set the test script to exit 0 if you do not have any tests. Commit your changes and push them to {% data variables.product.prodname_dotcom %}. {% raw %}
    $ npm init
      ...
      package name: <em>@YOUR-USERNAME/YOUR-REPOSITORY</em>
      ...
      test command: <em>exit 0</em>
      ...
    
    $ npm install
    $ git add index.js package.json package-lock.json
    $ git commit -m "initialize npm package"
    $ git push
    
    {% endraw %}
  5. From your repository on {% data variables.product.prodname_dotcom %}, create a new file in the .github/workflows directory named release-package.yml. For more information, see "Creating new files."
  6. Copy the following YAML content into the release-package.yml file. {% raw %}
    name: Node.js Package
    
    on:
      release:
        types: [created]
    
    jobs:
      build:
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: actions/setup-node@v1
            with:
              node-version: 12
          - run: npm ci
          - run: npm test
    
      publish-gpr:
        needs: build
        runs-on: ubuntu-latest
        steps:
          - uses: actions/checkout@v2
          - uses: actions/setup-node@v1
            with:
              node-version: 12
              registry-url: https://npm.pkg.github.com/
          - run: npm ci
          - run: npm publish
            env:
              NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
    
    {% endraw %}
  7. Scroll to the bottom of the page and select Create a new branch for this commit and start a pull request. Then, to create a pull request, click Propose new file.
  8. Merge the pull request.
  9. Navigate to the Code tab and create a new release to test the workflow. For more information, see "Managing releases in a repository."

Creating a new release in your repository triggers the workflow to build and test your code. If the tests pass, then the package will be published to {% data variables.product.prodname_registry %}.

Viewing your published package

Packages are published at the repository level. You can see all the packages in a repository and search for a specific package.

{% data reusables.repositories.navigate-to-repo %} {% data reusables.package_registry.packages-from-code-tab %} {% data reusables.package_registry.navigate-to-packages %}

Installing a published package

Now that you've published the package, you'll want to use it as a dependency across your projects. For more information, see "Configuring npm for use with {% data variables.product.prodname_registry %}."

Next steps

The basic workflow you just added runs any time a new release is created in your repository. But, this is only the beginning of what you can do with {% data variables.product.prodname_registry %}. You can publish your package to multiple registries with a single workflow, trigger the workflow to run on different events such as a merged pull request, manage containers, and more.

Combining {% data variables.product.prodname_registry %} and {% data variables.product.prodname_actions %} can help you automate nearly every aspect of your application development processes. Ready to get started? Here are some helpful resources for taking your next steps with {% data variables.product.prodname_registry %} and {% data variables.product.prodname_actions %}: