Skip to content

build: run CI build for forks #16

build: run CI build for forks

build: run CI build for forks #16

Workflow file for this run

name: Build
on:
push:
branches:
- master
pull_request:
branches-ignore:
- master
workflow_dispatch:
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install modules
run: npm ci
- name: Build
run: npm run build
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: "build"
path: "dist"
release:
name: Release
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/beta'
runs-on: ubuntu-latest
concurrency: release-${{ github.ref }}
environment:
name: npm
url: ${{ steps.set-npm-url.outputs.npm-url }}
permissions:
pages: write
id-token: write
contents: write
issues: write
pull-requests: write
needs:
- build
steps:
- uses: actions/checkout@v3
with:
lfs: true
- uses: actions/setup-node@v3
with:
node-version: "20"
- name: Install modules
run: npm ci
- uses: actions/download-artifact@v3
with:
path: artifacts
- name: Move artifacts
run: |
mv artifacts/build dist/
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
- name: Set npm package url to GITHUB_OUTPUT
id: set-npm-url
run: |
if [ -f .semanticRelease.npmPackage.deployedVersion.txt ]; then
echo "npm-url=https://www.npmjs.com/package/lifecycle-utils/v/$(cat .semanticRelease.npmPackage.deployedVersion.txt)" >> $GITHUB_OUTPUT
fi
- name: Generate docs with updated version
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
env:
DOCS_URL_BASE: "/lifecycle-utils/"
run: |
export DOCS_PACKAGE_VERSION=$(cat .semanticRelease.npmPackage.deployedVersion.txt)
npm run docs:build
- name: Upload docs to GitHub Pages
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v2
with:
name: pages-docs
path: docs-site
- name: Deploy docs to GitHub Pages
if: steps.set-npm-url.outputs.npm-url != '' && github.ref == 'refs/heads/master'
uses: actions/deploy-pages@v2
with:
artifact_name: pages-docs