From dbbcd546f6ef7565d2ceba59c62bb800726330bc Mon Sep 17 00:00:00 2001 From: Robert Knight Date: Fri, 31 May 2024 17:29:13 +0100 Subject: [PATCH] Add GitHub action for build workflow This will publish the ml-header-generator package. --- .github/workflows/build.yml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..f57fb65 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: build +on: + release: + types: [created] + push: + branches: + - "**" + paths: + - "header-gen/**" +jobs: + build: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./header-gen + permissions: + contents: read + packages: write + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: "20.x" + registry-url: "https://npm.pkg.github.com" + cache: npm + - uses: microbit-foundation/npm-package-versioner-action@v1 + - run: npm ci + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - run: npm run ci:update-version + - run: npm run build + - run: npm publish + if: github.ref == 'refs/heads/main' || github.event_name == 'release' && github.event.action == 'created' + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}