Skip to content

Update dependencies #35

Update dependencies

Update dependencies #35

Workflow file for this run

name: CI
on:
push:
branches:
- "*"
tags-ignore:
- "*"
jobs:
pipeline:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Environment Variables
run: |
echo "NODE_VERSION=$(cat .nvmrc)" >> $GITHUB_OUTPUT
echo "NEW_VERSION=$(cat package.json | jq -r '.version')" >> $GITHUB_OUTPUT
echo "PUBLISHED_VERSION=$(npm view arge version)" >> $GITHUB_OUTPUT
echo "BRANCH=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
id: env_vars
- name: Install Node.js ${{ steps.env_vars.outputs.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
registry-url: "https://registry.npmjs.org"
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Cache node_modules
uses: actions/cache@v2
with:
path: "**/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Security Audit
run: yarn audit || true
- name: Outdated Packages
run: yarn outdated || true
- name: Coding Standards
run: yarn lint
- name: Test
run: yarn test:coverage
- name: Type
run: yarn type
- name: Build
run: yarn build
- name: Create Changeset
run: |
CHANGELOG=$(git --no-pager log ${{ steps.env_vars.outputs.PUBLISHED_VERSION }}..HEAD --format="%C(auto)%h %s")
DELIMITER="$(openssl rand -hex 8)"
echo "RELEASE_NOTES<<${DELIMITER}" >> $GITHUB_OUTPUT
echo -e "$CHANGELOG" >> $GITHUB_OUTPUT
echo "${DELIMITER}" >> $GITHUB_OUTPUT
id: changeset
- name: Create Release
if: github.ref == 'refs/heads/main'
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
with:
tag_name: ${{ steps.env_vars.outputs.NEW_VERSION }}
release_name: ${{ steps.env_vars.outputs.NEW_VERSION }}
body: "${{ steps.changeset.outputs.RELEASE_NOTES }}\n\n**Full Changelog**: https://github.com/adhamu/arge/compare/${{ steps.env_vars.outputs.PUBLISHED_VERSION }}...${{ steps.env_vars.outputs.NEW_VERSION }}"
draft: false
prerelease: false
- name: Publish to Registry
run: |
pkg_version=${{ steps.env_vars.outputs.NEW_VERSION }}
branch=${{ steps.env_vars.outputs.BRANCH }}
if [[ $branch != "main" ]]; then
yarn version --new-version "$pkg_version-beta$GITHUB_RUN_NUMBER" --no-git-tag-version
yarn publish --tag beta --access public
else
yarn publish --access public
fi