mirror of
https://github.com/visgl/react-map-gl.git
synced 2025-12-08 20:16:02 +00:00
64 lines
1.6 KiB
YAML
64 lines
1.6 KiB
YAML
name: release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- v*
|
|
|
|
jobs:
|
|
check_branch:
|
|
runs-on: ubuntu-22.04
|
|
outputs:
|
|
should_build: ${{ steps.permitted.outputs.result }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
|
|
- name: Fetch remote branches
|
|
run: |
|
|
git fetch origin --depth=1
|
|
|
|
- name: Check if on permitted branch
|
|
id: permitted
|
|
run: |
|
|
result=
|
|
if git branch -a --contains $GITHUB_SHA | grep -q 'remotes/origin/master$'; then
|
|
result=true
|
|
elif git branch -a --contains $GITHUB_SHA | grep -q 'remotes/origin/.*-release$'; then
|
|
result=true
|
|
fi
|
|
echo "result=${result}" >> "$GITHUB_OUTPUT"
|
|
|
|
release:
|
|
runs-on: ubuntu-22.04
|
|
needs: check_branch
|
|
permissions:
|
|
contents: write
|
|
|
|
if: ${{ github.repository_owner == 'visgl' && needs.check_branch.outputs.should_build }}
|
|
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
|
|
- uses: volta-cli/action@2d68418f32546fd191eb666e232b321d5726484d # v4.1.1
|
|
with:
|
|
cache: 'yarn'
|
|
|
|
- name: Install dependencies
|
|
run: yarn
|
|
|
|
- name: Build packages
|
|
run: npm run build
|
|
|
|
- name: Run tests from transpiled code
|
|
run: npx ocular-test dist
|
|
|
|
- name: Login to NPM
|
|
run: npm config set "//registry.npmjs.org/:_authToken=${NPM_ACCESS_TOKEN}"
|
|
|
|
- name: Publish to NPM
|
|
run: npx ocular-publish from-git
|