Skip to content

Workflow file for this run

name: Build and Publish phoenix-websocket
# Controls when the workflow will run
on:
release:
types: [released]
env:
DESIRED_NODE_VERSION: 20
jobs:
build-and-deploy:
runs-on: ubuntu-latest
concurrency: build-and-deploy
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ env.DESIRED_NODE_VERSION }}
- name: Set sources version
run: |
VERSION="${{ github.ref }}"
if [ -z "$VERSION" ]
then
echo "Version empty"
exit 1
fi
if [[ $VERSION == *"/tags/"* ]]
then
echo "Version is tag."
VERSION="${VERSION##*/v}"
else
echo "Version unexpected format"
exit 1
fi
echo "Version trimmed to $VERSION"
echo "BUILD_VERSION=$VERSION" >> $GITHUB_ENV
- uses: falnyr/replace-env-vars-action@master
with:
filename: package.json
- name: Install npm dependencies
run: |
npm ci --production=false
- name: Run build
run: npm run build
- uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'
# NOTE:
# By default NPM access tokens expire after a year, and so these will need to be updated when the build starts to fail.
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
- name: Generate docs
run: npm run docs
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs/
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2 # or the latest "vX.X.X" version tag for this action
with:
token: ${{ github.token }}