v240122-2 #8
Workflow file for this run
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: Publish Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
publish-release: | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.event.repository.url, 'smithmicro/mapbox-gl-circle') }} | |
permissions: | |
packages: write | |
contents: write | |
steps: | |
# - uses: hmarr/debug-action@v2 | |
- uses: actions/checkout@v3 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
ref: master | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- run: npm ci | |
- name: Publish Release ${{ github.event.release.name }} | |
run: | | |
# Versioning | |
PKG_VERSION=$(npm version from-git) | |
export BUILD_VERSION=${PKG_VERSION/v/} | |
CHANGELOG_SECTION="### v. $BUILD_VERSION" | |
echo "Ensure changelog has a '$CHANGELOG_SECTION' section ..." && grep -Fq "$CHANGELOG_SECTION" README.md | |
# Build API documentation | |
npm run docs | |
# Build and publish to GHP | |
npm pkg set name=@smithmicro/mapbox-gl-circle | |
npm install | |
rm -rf dist/ | |
npm run browserify | |
npm run prepare | |
echo 'registry=https://npm.pkg.github.com' >> .npmrc | |
echo '//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}' >> .npmrc | |
npm publish --tag=latest --access=public | |
git restore .npmrc | |
echo "Release @smithmicro/mapbox-gl-circle-$BUILD_VERSION published to GHP." | |
# Build and publish to NPM | |
npm pkg set name=mapbox-gl-circle | |
npm install | |
rm -rf dist/ | |
npm run browserify | |
npm run prepare | |
echo 'registry=https://registry.npmjs.org' >> .npmrc | |
echo '//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}' >> .npmrc | |
npm publish --tag=latest --access=public | |
git restore .npmrc | |
echo "Release mapbox-gl-circle-$BUILD_VERSION published to NPM." | |
git config --local user.email "actions@github.com" | |
git config --local user.name "GitHub Actions" | |
git add README.md package.json package-lock.json | |
git status | |
git commit -m":package: [skip ci] Release \`$BUILD_VERSION\` by :robot: | |
Co-authored-by: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
" | |
git log -n 2 | |
echo "Done." && exit 0 | |
- name: Push Version Update | |
uses: ad-m/github-push-action@master | |
with: | |
branch: master | |
github_token: ${{ secrets.GHA_MAPBOXGLCIRCLE_GITHUB_TOKEN }} |