Publish #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################################################################################ | |
# DO NOT EDIT THIS FILE (Auto-Generated) - COPY IT! # | |
# # | |
# Contents of this file were generated by https://github.com/parcelLab/.github # | |
# Changes to this file may be overwritten. # | |
# # | |
# Copy this file into the repo .github/workflows folder and edit it based on # | |
# your needs to create a new workflow. Rename it to `publish.yaml`. # | |
################################################################################ | |
name: Publish | |
on: | |
push: | |
tags: | |
- "v*" | |
workflow_dispatch: | |
inputs: | |
version: | |
description: The version to publish (without 'v', e.g. 1.0.0) | |
required: true | |
jobs: | |
version: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.load_version.outputs.version }} | |
steps: | |
- name: Load version | |
id: load_version | |
run: | | |
if [ "$GITHUB_EVENT_NAME" = 'workflow_dispatch' ] | |
then | |
VERSION="${{ github.event.inputs.version }}" | |
else | |
if [ "$GITHUB_EVENT_NAME" = 'release' ] | |
then | |
TAG_NAME="${{ github.event.release.tag_name }}" | |
else | |
TAG_NAME="${{ github.ref }}" | |
fi | |
CLEAN_TAG=${TAG_NAME##*/} | |
VERSION=${CLEAN_TAG//v} | |
fi | |
echo "::set-output name=version::$VERSION" | |
publish: | |
needs: version | |
uses: ./.github/workflows/_npm_publish.yaml | |
with: | |
# access: public # For public packages | |
# buildBeforePublish: false # For packages that do not require a build step | |
version: ${{ needs.version.outputs.version }} | |
secrets: | |
githubAuthToken: ${{ secrets.REPO_ACCESS_TOKEN }} | |
# npmjsAuthToken: ${{ secrets.NPM_TOKEN }} # For public packages |