Coder Social home page Coder Social logo

madcitymultimedia-admin / build-and-tag-action Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jasonetco/build-and-tag-action

1.0 0.0 1.0 539 KB

๐Ÿ“ฆ๐Ÿ”– A GitHub Action for publishing JavaScript Actions

License: MIT License

TypeScript 100.00%

build-and-tag-action's Introduction

๐Ÿ“ฆ๐Ÿ”–

Build and Tag action

GitHub Actions status Codecov


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:

  • Reads the main property in your package.json
  • Force pushes action.yml and the above file to the release's tag
  • Force pushes to the major version tag (ex: v1.0.0 -> v1)

image

This repository even uses it! @vercel/ncc supports TypeScript out of the box ๐Ÿ˜

Usage

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.

Options

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 }}

Motivation

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.

build-and-tag-action's People

Contributors

jasonetco avatar andyfeller avatar mheap avatar dependabot[bot] avatar nzws avatar layzeedk avatar shem8 avatar

Stargazers

MAD CITY MULTIMEDIA avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.