Skip to content

Removes husky (#160) #49

Removes husky (#160)

Removes husky (#160) #49

Workflow file for this run

name: Release to npm
on:
push:
branches:
- main
jobs:
Release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: "18.x"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
run: yarn install --frozen-lock-file --prefer-offline
- name: Get version from package.json before release step
id: initversion
run: echo "::set-output name=version::$(npm run get-version --silent)"
- name: Release to NPM
id: release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GIT_AUTHOR_NAME: duffel-bot
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: duffel-bot
GIT_COMMITTER_EMAIL: [email protected]
DUFFEL_API_URL: https://api.duffel.com
COMPONENT_CDN: https://assets.duffel.com/components
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
run: yarn release
- name: Get version from package.json after release step
id: extractver
run: echo "::set-output name=extractver::$(npm run get-version --silent)"
- name: Check if package versions are different
run: |
echo "Init Version - ${{ steps.initversion.outputs.version }}"
echo "extract version - ${{ steps.extractver.outputs.extractver }}"
echo "extract version - ${{ steps.initversion.outputs.version != steps.extractver.outputs.extractver }}"
- name: Create Pull Request with updated package files
id: cpr
if: steps.initversion.outputs.version != steps.extractver.outputs.extractver
uses: peter-evans/[email protected]
with:
token: ${{ secrets.PAT }} # You can fin this on https://duffel.1password.com/vaults/all/allitems/m3heg3y3ijclli4tmmp4bsyxna
commit-message: "chore(release): ${{ steps.extractver.outputs.extractver }}"
committer: duffel-bot <[email protected]>
author: duffel-bot <[email protected]>
title: "chore(release): ${{ steps.extractver.outputs.extractver }}"
body: "Version bump in package.json for release [${{ steps.extractver.outputs.extractver }}](https://github.com/${{github.repository}}/releases/tag/v${{ steps.extractver.outputs.extractver }})"
branch: version-bump/${{ steps.extractver.outputs.extractver }}
labels: |
automated pr
- name: Check outputs
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"
- name: Enable Pull Request Automerge
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v1
with:
token: ${{ secrets.PAT }}
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: squash