ci: fix #43
Workflow file for this run
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
name: Release | |
on: | |
push: | |
branches: [master, feature/*] | |
jobs: | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'skip ci')" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: { fetch-depth: 0 } | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Set Branch | |
id: branch | |
run: | | |
BNAME="$(echo -n ${GITHUB_REF##*/} | sed 's#/#-#g' | tr '[:upper:]' '[:lower:]')" | |
BID="$GITHUB_RUN_NUMBER-$(date +%s)" | |
echo "BRANCH_NAME=$BNAME" >> $GITHUB_ENV | |
echo "APP_BUILD=$BID-$GITHUB_SHA" >> $GITHUB_ENV | |
echo "BUILD_ID=$BID" >> $GITHUB_ENV | |
- name: Setup GIT | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
mkdir -p ~/.ssh | |
ssh-keyscan github.com > ~/.ssh/known_hosts | |
- name: Setup NPM | |
run: | | |
echo "Setup NPM" | |
echo 'always-auth=true' > ~/.npmrc | |
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' >> ~/.npmrc | |
echo '//npm.pkg.github.com/:_authToken=${GH_TOKEN}' >> ~/.npmrc | |
- name: Install dependencies | |
run: npm ci | |
- name: Check | |
run: | | |
npm run check-types | |
npm run lint | |
npm run test | |
- name: Build | |
run: npm run build | |
- name: Release GITHUB | |
run: | | |
if [[ $BRANCH_NAME == 'master' ]]; then | |
echo "Release production" | |
npm run release publish-github publish-npmjs | |
else | |
echo "Release canary" | |
npm run release -- publish-github prerelease=$BRANCH_NAME.$BUILD_ID | |
fi |