Skip to content

Merge branch 'develop' #39

Merge branch 'develop'

Merge branch 'develop' #39

# Automatically generate a release on develop and main
name: Automated release and build of project
on:
push:
branches:
- main
- develop
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Export node version
id: node_version
run: echo ::set-output name=NODE_VERSION::$(cat .nvmrc)
- uses: nelonoel/branch-name@v1.0.1
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ steps.node_version.outputs.NODE_VERSION }}
registry-url: https://registry.npmjs.org/
- name: Create npm module
run: npm pack
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}}
- name: Get current release version from package.json
id: package-version
uses: martinbeentjes/npm-get-version-action@main
with:
path: ./
- name: Set release tag
# https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable
# On the develop branch this might create RELEASE_VERSION=2.4.6-987654321-develop
# On the master branch this would then only create RELEASE_VERSION=2.4.6
run: echo "RELEASE_VERSION=$(printf -- '%s%s\n' ${{steps.package-version.outputs.current-version}} $([ ${BRANCH_NAME} = "develop" ] && printf -- '-%s-develop' ${GITHUB_RUN_ID} || echo ""))" >> $GITHUB_ENV
- name: Create release
uses: ncipollo/release-action@v1.8.8
with:
name: ${{ env.RELEASE_VERSION }}
tag: v${{ env.RELEASE_VERSION }}
artifacts: "sanger-ui-styling-${{ steps.package-version.outputs.current-version}}.tgz"
artifactErrorsFailBuild: true