Skip to content

Commit

Permalink
Create workflopublish.yml
Browse files Browse the repository at this point in the history
Here’s the updated `README.md` file and the GitHub Actions workflow (`publish.yml`) for publishing your package to npm:

### Updated `README.md`

```markdown
# Aenzbi

Business management software including POS functionalities integrated with EBMS Burundi.

## Features

- Create invoices with customer and item details.
- Calculate total amounts before and after tax.
- Post the generated invoice to the EBMS API.

## Installation

You can install this package using npm:

```bash
npm install aenzbi
```

## Usage

// Provide usage instructions here

## File Structure

```
.
├── app.py                  # Main application file
├── templates
│   └── facture_form.html   # HTML form template
├── .github
│   └── workflows
│       └── publish.yml     # GitHub Actions workflow for publishing to npm
└── README.md               # This file
```

## Continuous Integration with GitHub Actions

This repository includes a GitHub Actions workflow to run Pylint on the codebase and publish the package to npm. The workflow is triggered on every push to the repository.

### GitHub Actions Workflow

The workflow file is located at `.github/workflows/publish.yml`.

```yaml
name: Publish to npm

on:
  push:
    tags:
      - "v*"

jobs:
  publish:
    runs-on: ubuntu-latest

    steps:
    - name: Check out the repository
      uses: actions/checkout@v4

    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '16'
        registry-url: 'https://registry.npmjs.org/'

    - name: Install dependencies
      run: npm install

    - name: Publish to npm
      run: npm publish
      env:
        NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```

### Explanation

- **name**: The name of the workflow. Here, it's called "Publish to npm".
- **on**: Specifies the events that trigger the workflow. It runs on `push` events with tags matching `v*`.
- **jobs**: Defines the job named `publish`.
  - **runs-on**: Specifies the type of runner to use. Here, it uses the latest Ubuntu runner.
  - **steps**: Defines the steps to be executed in the job.
    - **Check out the repository**: Uses the `actions/checkout@v4` action to check out the repository.
    - **Set up Node.js**: Sets up Node.js using the `actions/setup-node@v3` action.
    - **Install dependencies**: Installs the necessary dependencies using npm.
    - **Publish to npm**: Publishes the package to npm using the `npm publish` command.

### Setting Up Secrets in GitHub

1. Go to your GitHub repository.
2. Navigate to `Settings` > `Secrets and variables` > `Actions`.
3. Click `New repository secret`.
4. Add a secret with the name `NPM_TOKEN` and your npm token as the value. You can generate an npm token from your npm account settings.

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request.

## Contact

For any inquiries, please contact Ally Elvis Nzeyimana at [your-email@example.com].
```

### GitHub Actions Workflow (`publish.yml`)

Save the following configuration in a `.github/workflows/publish.yml` file in your repository:

```yaml
name: Publish to npm

on:
  push:
    tags:
      - "v*"

jobs:
  publish:
    runs-on: ubuntu-latest

    steps:
    - name: Check out the repository
      uses: actions/checkout@v4

    - name: Set up Node.js
      uses: actions/setup-node@v3
      with:
        node-version: '16'
        registry-url: 'https://registry.npmjs.org/'

    - name: Install dependencies
      run: npm install

    - name: Publish to npm
      run: npm publish
      env:
        NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
```

This setup will ensure that your package is correctly published to npm whenever you push a new tag matching the pattern `v*` to your repository.
  • Loading branch information
allyelvis authored Jul 11, 2024
1 parent 9c72169 commit 1cbd8f8
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflopublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
### GitHub Actions Workflow (`publish.yml`)

Save the following configuration in a `.github/workflows/publish.yml` file in your repository:

```yaml
name: Publish to npm
on:
push:
tags:
- "v*"
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org/'
- name: Install dependencies
run: npm install
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 1cbd8f8

Please sign in to comment.