Skip to content

create new branch with source from https://github.com/literalEval/fw-… #75

create new branch with source from https://github.com/literalEval/fw-…

create new branch with source from https://github.com/literalEval/fw-… #75

Workflow file for this run

name: Publish packages
on:
push:
branches-ignore:
- "dependabot/**"
env:
BRANCH_TAG: ${{ github.ref_name == 'main' && 'latest' || github.ref_name }}
BRANCH: ${{ github.ref_name }}
jobs:
build_test_publish:
runs-on: ubuntu-latest
environment: "${{ github.ref_name == 'main' && 'prod' || '' }}"
steps:
- name: Generate token
if: ${{ github.ref_name == 'main'}}
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ vars.FUNDABOT_APP_ID }}
private_key: ${{ secrets.FUNDABOT_PRIVATE_KEY }}
- uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org
- uses: actions/checkout@v3
with:
# pulls all commits and tags (needed for lerna to correctly version)
fetch-depth: 0
token: ${{ github.ref_name == 'main' && steps.generate_token.outputs.token || secrets.GITHUB_TOKEN }}
- name: Setup git
run: |
git config --global user.email "[email protected]"
git config --global user.name "fundabot"
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Run tests
run: npm run test
- name: Publish packages
env:
MAJOR_VERSION: ${{ contains(github.event.head_commit.message , '[bump major]') }}
MINOR_VERSION: ${{ contains(github.event.head_commit.message , '[bump minor]') }}
NODE_AUTH_TOKEN: ${{secrets.NPMJS_TOKEN}}
run: |
VERSION=${{ github.ref_name == 'main' && 'patch' || 'prerelease' }}
if [ ${{ github.ref_name }} == 'main' ]
then
if [ $MINOR_VERSION == true ]; then VERSION="minor"; fi
if [ $MAJOR_VERSION == true ]; then VERSION="major"; fi
fi
echo "Updating $VERSION.."
npm run publish -- $VERSION --yes --dist-tag=$BRANCH_TAG --no-push --preid ${{ github.ref_name }} ${{ github.ref_name == 'main' && '' || '--include-merged-tags' }}
TAG="`git describe --tags --abbrev=0`"
echo "Published tag $TAG"
echo "TAG=$TAG" >> $GITHUB_ENV
- name: Release
if: ${{ github.ref_name == 'main'}}
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "${BRANCH}" != "main" ]; then PRERELEASE="-p"; fi
echo "Releasing version ${TAG} on branch ${BRANCH}"
gh release create ${TAG} --target ${BRANCH} --generate-notes ${PRERELEASE}
- name: Push changes
run: git push --follow-tags --atomic --no-verify