Skip to content

fix api build script #8

fix api build script

fix api build script #8

name: eoh-release-api-package
on:
release:
types: [ created ]
push:
branches:
- 'develop'
- 'feature/**'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: "Setup Node"
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- name: "Setup NPM Registries"
working-directory: .
run: |
echo "@gtibrett:registry=https://npm.pkg.github.com" > ~/.npmrc
echo "@fortawesome:registry=https://npm.fontawesome.com/" > ~/.npmrc
echo "//npm.fontawesome.com/:_authToken=${{ secrets.FONT_AWESOME_KEY }}" > ~/.npmrc
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install"
working-directory: ./packages/api
run: yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_PAT_TOKEN }}
- name: "Build"
working-directory: ./packages/api
run: yarn build
- name: "Copy README.md"
working-directory: ./packages/api
run: cp README.md dist/README.md
- name: "Copy package.json"
working-directory: ./packages/api
run: |
version=$(jq -r '.version' package.json)
timestamp=$(date +%s)
if [[ "$version" == *alpha* ]] || [[ "$version" == *beta* ]]
then
jq .version="\"$version.$timestamp\"" package.json > dist/package.json
else
cp package.json dist/package.json
fi
ls -al dist/
- name: "Publish"
working-directory: ./packages/api
run: |
version=$(jq -r '.version' package.json)
timestamp=$(date +%s)
if [[ "$version" == *alpha* ]]
then
yarn publish --tag alpha ./dist
elif [[ "$version" == *beta* ]]
then
yarn publish --tag beta ./dist
else
yarn publish ./dist
fi
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_PAT_TOKEN}}