Skip to content

Next Release

Next Release #77

Workflow file for this run

name: Next Release
on:
workflow_dispatch:
inputs:
prNumber:
description: Number of PR
required: false
ref:
description: The branch that is being deployed.
required: false
default: next
repository:
description: The {owner}/{repository} that is being deployed.
required: false
default: Garlic-Team/gcommands
jobs:
release:
name: publish
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
repository: ${{ github.event.inputs.repository || 'Garlic-Team/GCommands' }}
ref: ${{ github.event.inputs.ref || 'next' }}
- name: Install Node v16
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Install dependencies
run: npm ci
- name: Build a package
run: npm run build
- name: Deprecate old versions
run: |
if [ '${{ github.event.inputs.prNumber }}' == '' ]; then
npm deprecate gcommands@"~$(jq --raw-output '.version' package.json)-next" "This version is no longer supported. Please upgrade to the latest version using npm i gcommands@latest" || true
else
npm deprecate gcommands@"~$(jq --raw-output '.version' package.json)-pr-${{ github.event.inputs.prNumber }}" "This version is no longer supported. Please upgrade to the latest version using npm i gcommands@latest" || true
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
- name: Publish a NPM package
run: |
TAGINVER=$([[ '${{ github.event.inputs.prNumber }}' == '' ]] && echo '-next' || echo '-pr-${{ github.event.inputs.prNumber }}')
TAG=$([[ '${{ github.event.inputs.prNumber }}' == '' ]] && echo 'next' || echo 'pr-${{ github.event.inputs.prNumber }}')
npm version --git-tag-version=false $(jq --raw-output '.version' package.json)${TAG}.$(date +%s)
npm publish --tag ${TAG} || true
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}