0.1.1 #23
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: Test & Deploy | |
on: | |
# Runs on pushes targeting the default branch | |
push: | |
branches: [ main ] | |
tags: ['*'] | |
pull_request: | |
branches: [ main ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup NodeJS | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build the app | |
run: npm run build | |
- name: Test | |
run: npm run test | |
- name: save the built | |
uses: actions/upload-artifact@v4 | |
if: "!failure()" | |
with: | |
retention-days: 1 | |
name: the-built | |
path: | | |
dist/ | |
publish: | |
name: Publish npm package | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
tag_name: 'v%s' | |
node-version: '20.x' | |
registry-url: 'https://registry.npmjs.org' | |
scope: '@geolonia' | |
- name: load the built | |
uses: actions/download-artifact@v4 | |
with: | |
name: the-built | |
- name: Publish to NPM (latest) | |
if: "!contains(github.ref, '-pre.')" | |
run: npm publish --access=public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Publish to NPM (next) | |
if: "contains(github.ref, '-pre.')" | |
run: npm publish --access=public --tag=next | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Checkout geolonia/cdn.geolonia.com | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.PAT_FOR_CDN_GEOLONIA_COM }} | |
repository: geolonia/cdn.geolonia.com | |
path: ./cdn.geolonia.com | |
- name: Build Geojson Lookfor | |
run: npm run build:embed | |
working-directory: ./cdn.geolonia.com | |
- name: Create PR in geolonia/cdn.geolonia.com | |
uses: peter-evans/create-pull-request@v4 | |
with: | |
token: ${{ secrets.PAT_FOR_CDN_GEOLONIA_COM }} | |
path: ./cdn.geolonia.com | |
title: 'Release @geolonia/geojson-lookup' | |
body: | | |
Release @geolonia/geojson-lookfor | |
https://github.com/geolonia/geojson-lookfor の GitHub Actions によって自動作成 |