![]() Next, I’m going to setup some git config (user.name and user.email) in preparation of pushing new git tags up to GitHub. Uses : actions/setup : node-version : 8 - name : npm install ![]() Next, I’ll specify I want it to use Node.js version 8 and to run npm install to make sure all the dependent packages are installed: - name : Install Node.js So far, my workflow will run using the latest commit on the master branch, after a Pull Request is merged. Also, I’ll specify that I want the workflow to checkout and use the master branch ( refs/heads/master). Here, I will tell it to only trigger if a pull request is closed because it was merged ( if: _rged). Above, I told this workflow to trigger on pull requests being closed. These are the steps the “publish” job will run, in sequential order. Now we get to the main part of the workflow. This is pretty standard stuff: jobs : publish : runs-on : ubuntu -latest Now, the next bit simply names the first (and only) job in the workflow “publish” and tells GitHub Actions to run it on the latest supported version of Ubuntu. Those additional filters will come later. But, I actually only want it to run when a PR is merged and I want it to run on the master branch. When should GitHub Actions run this workflow? Any time a Pull Request is closed. The first bit is the trigger clause: name : Publish to npm Registry The full workflow script is in the xertz repository so if you just want to take a quick look, please do.īelow, I will work through the script. Automated scripts for deploying to npm are certainly not a new things but getting this working on GitHub Actions was a new thing for me. This is one less thing I have to do manually when I want to get a change out to a package I manage. With this workflow, when I merge a PR, a new release will be tagged and pushed up to npm. ![]() I wanted to walk through the workflow I wrote to release a new version to the npm registry. ![]() ![]() Most recently I got xertz, my static site generator project, running on GitHub Actions for build/test and releases to the npm registry. I have been playing with GitHub Actions quite a bit recently at YNAB and for some personal projects and it has been fun. GitHub Actions Version and Release to npm ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |