Skip to content

Publish

Publish #31

Workflow file for this run

name: Publish
on:
workflow_dispatch:
inputs:
release_version:
description: "Version of this release"
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
- name: Cache 📦
uses: actions/cache@v3
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup ⬢
uses: actions/setup-node@v3
with:
node-version: 18
- name: Version 👍
id: version-bump
uses: jaywcjlove/[email protected]
with:
version: ${{ github.event.inputs.release_version }}
- name: Install 🔧
run: npm install
- name: Build 🛠
run: npm run build
- name: Tag 🏷️
uses: actions/github-script@v6
id: create-tag
with:
github-token: ${{secrets.TEXTILEIO_MACHINE_ACCESS_TOKEN}}
script: |
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ github.event.inputs.release_version }}',
sha: context.sha
})
- name: Conditional ✅
id: cond
uses: haya14busa/action-cond@v1
with:
cond: ${{ contains(github.event.inputs.release_version, '-') }}
if_true: "next"
if_false: "latest"
- name: Publish 📦
id: publish
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.NPM_AUTH_TOKEN }}
tag: ${{ steps.cond.outputs.value }}
access: public
- name: Release 🚀
if: steps.publish.outputs.type != 'none'
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.publish.outputs.version }}
generateReleaseNotes: true
prerelease: ${{ contains(steps.publish.outputs.type, 'pre') }}
token: ${{ secrets.GITHUB_TOKEN }}