Skip to content

Deploy Tracker

Deploy Tracker #37

Workflow file for this run

name: Deploy Tracker
on:
workflow_dispatch:
inputs:
version:
description: 'The release tag'
required: true
jobs:
deploy:
runs-on: ubuntu-20.04
env:
NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
BROWSERSLIST_IGNORE_OLD_DATA: true
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js 16
uses: actions/setup-node@v3
with:
node-version: 16
- name: pnpm cache
uses: actions/cache@v3
with:
path: ./common/temp/pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('common/config/rush/pnpm-lock.yaml') }}
restore-keys: ${{ runner.os }}-pnpm-
- name: Rush Install
run: node common/scripts/install-run-rush.js install
- name: Setup git
uses: oleksiyrudenko/[email protected]
with:
token: '${{ secrets.GITHUB_TOKEN }}'
name: github-actions[bot]
email: 41898282+github-actions[bot]@users.noreply.github.com
- name: Rush Version
run: node common/scripts/install-run-rush.js version --bump --target-branch master --ignore-git-hooks
- name: Get version
id: version
run: echo "TRACKER_VERSION=$(node -p "require('./trackers/javascript-tracker/package.json').version")" >> $GITHUB_OUTPUT
- name: Fail if version mismatch
if: ${{ github.event.inputs.version != steps.version.outputs.TRACKER_VERSION }}
run: |
echo "Input version (${{ github.event.inputs.version }}) doesn't match version in project (${{ steps.version.outputs.TRACKER_VERSION }})"
exit 1
- name: Rush Build
run: node common/scripts/install-run-rush.js rebuild --verbose
- name: Rush Test
run: node common/scripts/install-run-rush.js test --verbose
- name: Install API Extractor & Documenter
run: npm install -g @microsoft/[email protected] @microsoft/[email protected]
- name: Create API documentation for @snowplow/browser-tracker
working-directory: ./trackers/browser-tracker
run: |
api-extractor run
api-documenter markdown --input-folder temp --output-folder docs/markdown
- name: Create API documentation for @snowplow/node-tracker
working-directory: ./trackers/node-tracker
run: |
api-extractor run
api-documenter markdown --input-folder temp --output-folder docs/markdown
- name: Apply API documentation updates
run: |
git add trackers/browser-tracker/docs
git add trackers/node-tracker/docs
git commit --no-verify --allow-empty -m "Applying documentation updates."
git push
- name: Rush Publish
run: node common/scripts/install-run-rush.js publish --apply --include-all --publish --target-branch master --set-access-level public --ignore-git-hooks
- name: Generate Release Information
id: tag_version
uses: mathieudutour/[email protected]
with:
dry_run: true
github_token: ${{ secrets.GITHUB_TOKEN }}
tag_prefix: ''
default_bump: false
custom_tag: ${{ github.event.inputs.version }}
- name: Tag release
run: |
git tag -a ${{ steps.tag_version.outputs.new_tag }} -m "Version ${{ steps.tag_version.outputs.new_tag }}"
git push --tags
- name: Zip plugins
run: zip -r plugins.umd.zip ./plugins/*/dist/*.umd*.js*
- name: Publish Release
uses: softprops/action-gh-release@v1
with:
name: Version ${{ steps.tag_version.outputs.new_tag }}
tag_name: ${{ steps.tag_version.outputs.new_tag }}
body: ${{ steps.tag_version.outputs.changelog }}
files: |
./trackers/javascript-tracker/dist/sp.js
./trackers/javascript-tracker/dist/sp.js.map
./trackers/javascript-tracker/dist/sp.lite.js
./trackers/javascript-tracker/dist/sp.lite.js.map
./plugins.umd.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}