Skip to content

Add NVM3/APP clearing support #53

Add NVM3/APP clearing support

Add NVM3/APP clearing support #53

name: Create tag and tarballs release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
force:
description: 'Force update release if tag already exists (re-adds tarballs from scratch)'
required: false
default: false
type: boolean
jobs:
check-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Check if version already exists
id: version-check
run: |
tag="v$(jq -r < package.json .version)"
exists=$(gh api repos/${{ github.repository }}/releases/tags/$tag >/dev/null 2>&1 && echo "true" || echo "")
if [ -n "$exists" ];
then
echo "Version $tag already exists"
echo "::warning file=package.json,line=1::Version $tag already exists."
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "Version $tag does not exist."
echo "skip=false" >> $GITHUB_OUTPUT
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
outputs:
skip: ${{ steps.version-check.outputs.skip }}
tag: ${{ steps.version-check.outputs.tag }}
create-release:
runs-on: ubuntu-latest
permissions:
contents: write
needs: [check-version]
if: |
!fromJSON(needs.check-version.outputs.skip) || fromJSON(inputs.force || false)
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version-file: 'package.json'
- run: npm install -g oclif
- run: npm ci
- run: npm run build:run
- run: oclif pack tarballs -r . --prune-lockfiles
- name: Create Github Release
uses: ncipollo/release-action@v1
with:
name: ${{ needs.check-version.outputs.tag }}
tag: ${{ needs.check-version.outputs.tag }}
commit: ${{ github.ref_name }}
generateReleaseNotes: true
makeLatest: true
allowUpdates: true
removeArtifacts: true
artifacts: "./dist/ember-zli-*"