Build and release specs #1537
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: Build and release specs | |
on: | |
push: | |
paths: | |
- "src/**/*.ts" | |
- "!package.json" | |
branches: | |
# We only want to create a new release when | |
# - a pr is merged to master | |
# - we push into master | |
- "master" | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.FIG_BOT_TOKEN }} | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: package.json | |
# Install all dependencies | |
- name: Install pnpm | |
uses: pnpm/[email protected] | |
- name: install | |
run: pnpm install --frozen-lockfile | |
# Transpile all specs from ts to js | |
- name: build | |
run: pnpm build | |
# Zip the transpiled files into the specs.zip file | |
- name: bundle files | |
run: | | |
mv build/ specs/ | |
zip -r specs.zip specs/ | |
mv specs/ build/ | |
# Bump the version and create a git tag with the new version | |
- name: Bump version and push tag | |
id: tag_version | |
uses: mathieudutour/[email protected] | |
with: | |
tag_prefix: spec-build-number- | |
# Bump versions in full numbers (1.0.0 -> 2.0.0) | |
default_bump: minor | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# Create a new github release with the newly created specs.zip file | |
- name: Release | |
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 | |
with: | |
files: specs.zip | |
tag_name: ${{ steps.tag_version.outputs.new_tag }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: "Automated Version Bump" | |
uses: "phips28/gh-action-bump-version@master" | |
env: | |
GITHUB_TOKEN: ${{ secrets.FIG_BOT_TOKEN }} | |
with: | |
skip-tag: "true" | |
- name: Publish to npm | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
access: public | |
token: ${{ secrets.NPM_PUBLISH_TOKEN }} |