From 1cbd8f83366cccd6855ddd79ddfda1d1662e9e7c Mon Sep 17 00:00:00 2001 From: Ally Elvis Nzeyimana <155692151+allyelvis@users.noreply.github.com> Date: Thu, 11 Jul 2024 21:01:41 +0200 Subject: [PATCH] Create workflopublish.yml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- .github/workflopublish.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflopublish.yml diff --git a/.github/workflopublish.yml b/.github/workflopublish.yml new file mode 100644 index 0000000..f2d6501 --- /dev/null +++ b/.github/workflopublish.yml @@ -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 }}