T71 common package update. #342
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: CI | |
on: | |
push: | |
pull_request: | |
branches: [ master ] | |
env: | |
ARCHIVE_API_ROOT: https://archive.timing71.org | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js environment | |
uses: actions/setup-node@v3 | |
with: | |
always-auth: true | |
node-version: 18 | |
cache: "yarn" | |
- name: Set up token for private package access | |
env: | |
GH_PACKAGES_TOKEN: ${{ secrets.GH_PACKAGES_TOKEN }} | |
run: | | |
echo "@timing71:registry=https://npm.pkg.github.com" > .npmrc | |
echo "//npm.pkg.github.com/:_authToken=${GH_PACKAGES_TOKEN}" >> .npmrc | |
echo "always-auth=true" >> .npmrc | |
- name: Install dependencies | |
run: yarn install | |
- name: Run eslint | |
run: yarn run lint | |
- name: Force version in package.json to match Git tag | |
if: ${{ github.ref_type == 'tag' }} | |
run: | | |
sed -i -e "s/\(version\": \"\)[0-9\.]*/\1${{github.ref_name}}/" package.json | |
- name: Append build metadata to package.json version field | |
run: | | |
sed -i -e "s/\(version\": \"[0-9\.]*\)-dev/\1+`echo ${{github.sha}} | cut -c1-7`/" package.json | |
- name: Build webapp | |
run: yarn run build | |
env: | |
COMMIT_REF: ${{ github.sha }} | |
REACT_APP_SENTRY_DSN: ${{ secrets.REACT_APP_SENTRY_DSN }} | |
GA_TRACKING_ID: ${{ secrets.GA_TRACKING_ID }} | |
- name: Run tests | |
run: yarn run test | |
# - name: Build CLI app | |
# run: yarn run cli:build | |
# - name: Publish CLI app | |
# uses: actions/upload-artifact@v3 | |
# with: | |
# name: 'timing71.js' | |
# path: 'cli/timing71.js' | |
- name: Publish to Netlify | |
if: github.ref == 'refs/heads/master' | |
uses: South-Paw/action-netlify-cli@v1 | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} | |
with: | |
args: deploy --json --dir=build --prod | |
- name: Create Sentry release | |
if: github.ref == 'refs/heads/master' | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: production | |
ignore_missing: true |