npm-semver-publish-action

For Developer

Table of Contents

Development

  1. Install the dependencies

    npm install
    
  2. Package the JavaScript for distribution

    npm run bundle
    
  3. Run the tests

    npm test
    

How to develop the GitHub Action

GitHub Actions Toolkit documentation.

  1. Create a new branch
  2. Update the contents of src/
  3. Add tests to __tests__/
  4. Format, test, and build the action

    npm run all
    

    [!WARNING]

    This step is important! It will run ncc to build the final JavaScript action code with all dependencies included. If you do not run this step, your action will not work correctly when it is used in a workflow. This step also includes the --license option for ncc, which will create a license file for all of the production node modules used in your project.

  5. Commit your changes

    git add .
    git commit -m "My first action is ready!"
    
  6. Push them to your repository

    git push -u origin releases/v1
    
  7. Create a pull request and get feedback on your action
  8. Merge the pull request into the main branch

Validate the Action

You can now validate the action by referencing it in a workflow file. For example, ci.yml demonstrates how to reference an action in the same repository.

steps:
  - name: Checkout
    id: checkout
    uses: actions/checkout@v3

  - name: Test Local Action
    id: test-action
    uses: ./
    with:
      target-branch: 'release'

  - name: Print Output
    id: output
    run: echo "$"