A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/JasonEtco/build-and-tag-action below:

JasonEtco/build-and-tag-action: 📦🔖 A GitHub Action for publishing JavaScript Actions

A GitHub Action for publishing JavaScript Actions! It's designed to act on new releases, and updates the tag with a compiled JS file, using @vercel/ncc. The process looks like this:

This repository even uses it! @vercel/ncc supports TypeScript out of the box 😍

name: Publish

on:
  release:
    types: [published, edited]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          ref: ${{ github.event.release.tag_name }}
      - name: Install deps and build
        run: npm ci && npm run build
      - uses: JasonEtco/build-and-tag-action@v2
        env:
          GITHUB_TOKEN: ${{ github.token }}

You can also use this action with other events - you'll just need to specify a tag_name (see below).

Example package.json for your project

The two important thing you'll need to set in your action are the main field and the build script. Here's an example of a minimal package.json that will use @vercel/ncc to compile your action to dist/index.js, update your action.yml file to use the node16 runtime and point build-and-tag-action at the compiled file:

{
  "name": "your-action-name",
  "main": "dist/index.js",
  "scripts": {
    "build": "npx @vercel/ncc build && npx convert-action"
  }
}

Your package.json will probably contain a dependencies section, in addition to other fields such as license.

tag_name

The tag to update. If the workflow event is release, it will use the tag_name from the event payload. This option can be useful when using this action in a workflow with other actions that generate a release:

- uses: fictional/releaser@v1 # Not a real action!
  id: releaser
- uses: JasonEtco/build-and-tag-action@v2
  with:
    tag_name: ${{ steps.releaser.outputs.tag_name }}

The guide to JavaScript Actions recommends including node_modules in your repository, and manual steps to following the versioning recommendations. There are anti-patterns there that just don't sit right with me; so we can enable the same workflow, automatically!

This Action is heavily inspired by mheap/github-action-auto-compile-node & Actions-R-Us/actions-tagger. This is more or less a combination of those two Actions, meant to work together.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4