main.yml (Leaflet-1.8.0) | : | main.yml (Leaflet-1.9.0) | ||
---|---|---|---|---|
name: CI | name: CI | |||
on: [push, pull_request] | on: [push, pull_request] | |||
permissions: | ||||
contents: read | ||||
env: | env: | |||
NODE_VERSION: 16 | NODE_VERSION: 16 | |||
jobs: | jobs: | |||
setup: | setup: | |||
runs-on: ${{ matrix.os }} | runs-on: ${{ matrix.os }} | |||
strategy: | strategy: | |||
matrix: | matrix: | |||
os: [ubuntu-latest, windows-2019] | os: [ubuntu-latest, windows-2019] | |||
steps: | steps: | |||
- name: Check out repository | - name: Check out repository | |||
uses: actions/checkout@v3 | uses: actions/checkout@v3 | |||
- name: Set up Node | - name: Set up Node | |||
uses: actions/setup-node@v3.1.0 | uses: actions/setup-node@v3 | |||
with: | with: | |||
node-version: ${{ env.NODE_VERSION }} | node-version: ${{ env.NODE_VERSION }} | |||
check-latest: true | check-latest: true | |||
cache: npm | cache: npm | |||
- name: Cache dependencies | - name: Cache dependencies | |||
id: cache-dependencies | id: cache-dependencies | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: node_modules | path: node_modules | |||
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} | |||
- name: Install dependencies | - name: Install dependencies | |||
if: steps.cache-dependencies.outputs.cache-hit != 'true' | if: steps.cache-dependencies.outputs.cache-hit != 'true' | |||
run: npm ci | run: npm ci | |||
- name: Cache setup | - name: Cache setup | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-setup | key: ${{ runner.os }}-${{ github.sha }}-setup | |||
build: | build: | |||
needs: setup | needs: setup | |||
runs-on: ${{ matrix.os }} | runs-on: ${{ matrix.os }} | |||
strategy: | strategy: | |||
matrix: | matrix: | |||
os: [ubuntu-latest, windows-2019] | os: [ubuntu-latest, windows-2019] | |||
steps: | steps: | |||
- name: Restore setup | - name: Restore setup | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-setup | key: ${{ runner.os }}-${{ github.sha }}-setup | |||
- name: Set up Node | - name: Set up Node | |||
uses: actions/setup-node@v3.1.0 | uses: actions/setup-node@v3 | |||
with: | with: | |||
node-version: ${{ env.NODE_VERSION }} | node-version: ${{ env.NODE_VERSION }} | |||
- name: Build project | - name: Build project | |||
run: npm run build | run: npm run build | |||
env: | env: | |||
NODE_ENV: ${{ startsWith(github.ref, 'refs/tags/v') && 'release' || '' }} | NODE_ENV: ${{ startsWith(github.ref, 'refs/tags/v') && 'release' || '' }} | |||
- name: Cache build | - name: Cache build | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-build | key: ${{ runner.os }}-${{ github.sha }}-build | |||
build-release: | build-release: | |||
needs: setup | needs: setup | |||
runs-on: ubuntu-latest | runs-on: ubuntu-latest | |||
steps: | steps: | |||
- name: Restore setup | - name: Restore setup | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-setup | key: ${{ runner.os }}-${{ github.sha }}-setup | |||
- name: Set up Node | - name: Set up Node | |||
uses: actions/setup-node@v3.1.0 | uses: actions/setup-node@v3 | |||
with: | with: | |||
node-version: ${{ env.NODE_VERSION }} | node-version: ${{ env.NODE_VERSION }} | |||
- name: Build project | - name: Build project | |||
run: npm run build | run: npm run build | |||
env: | env: | |||
NODE_ENV: release | NODE_ENV: release | |||
- name: Cache release build | - name: Cache release build | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-build-release | key: ${{ runner.os }}-${{ github.sha }}-build-release | |||
lint: | lint: | |||
needs: setup | needs: setup | |||
runs-on: ubuntu-latest | runs-on: ubuntu-latest | |||
steps: | steps: | |||
- name: Restore setup | - name: Restore setup | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-setup | key: ${{ runner.os }}-${{ github.sha }}-setup | |||
- name: Set up Node | - name: Set up Node | |||
uses: actions/setup-node@v3.1.0 | uses: actions/setup-node@v3 | |||
with: | with: | |||
node-version: ${{ env.NODE_VERSION }} | node-version: ${{ env.NODE_VERSION }} | |||
- name: Run lint task | - name: Run lint task | |||
run: npm run lint | run: npm run lint | |||
bundlemon: | bundlemon: | |||
needs: build-release | needs: build-release | |||
if: github.repository_owner == 'Leaflet' | if: github.repository_owner == 'Leaflet' | |||
runs-on: ubuntu-latest | runs-on: ubuntu-latest | |||
steps: | steps: | |||
- name: Restore release build | - name: Restore release build | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-build-release | key: ${{ runner.os }}-${{ github.sha }}-build-release | |||
- name: Set up Node | - name: Set up Node | |||
uses: actions/setup-node@v3.1.0 | uses: actions/setup-node@v3 | |||
with: | with: | |||
node-version: ${{ env.NODE_VERSION }} | node-version: ${{ env.NODE_VERSION }} | |||
- name: Run bundlemon task | - name: Run bundlemon task | |||
run: npm run bundlemon | run: npm run bundlemon | |||
env: | env: | |||
BUNDLEMON_PROJECT_ID: 61e0545915f6c3000980d0ed | BUNDLEMON_PROJECT_ID: 61e0545915f6c3000980d0ed | |||
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha || github.sha }} | |||
test: | test: | |||
skipping to change at line 150 | skipping to change at line 152 | |||
include: | include: | |||
- browser: Chrome1280x1024 | - browser: Chrome1280x1024 | |||
- browser: FirefoxTouch | - browser: FirefoxTouch | |||
- browser: FirefoxNoTouch | - browser: FirefoxNoTouch | |||
- browser: IE | - browser: IE | |||
os: windows-2019 | os: windows-2019 | |||
- browser: IE10 | - browser: IE10 | |||
os: windows-2019 | os: windows-2019 | |||
steps: | steps: | |||
- name: Restore build | - name: Restore build | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-build | key: ${{ runner.os }}-${{ github.sha }}-build | |||
- name: Set up Node | - name: Set up Node | |||
uses: actions/setup-node@v3.1.0 | uses: actions/setup-node@v3 | |||
with: | with: | |||
node-version: ${{ env.NODE_VERSION }} | node-version: ${{ env.NODE_VERSION }} | |||
- name: Run tests on ${{ matrix.browser }} | - name: Run tests on ${{ matrix.browser }} | |||
run: npm test -- --browsers ${{ matrix.browser }} | run: npm test -- --browsers ${{ matrix.browser }} | |||
publish-artifacts: | publish-artifacts: | |||
needs: build | needs: build | |||
if: github.repository_owner == 'Leaflet' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | if: github.repository_owner == 'Leaflet' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |||
runs-on: ubuntu-latest | runs-on: ubuntu-latest | |||
steps: | steps: | |||
- name: Restore build | - name: Restore build | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-build | key: ${{ runner.os }}-${{ github.sha }}-build | |||
- name: Compress artifacts | - name: Compress artifacts | |||
working-directory: dist | working-directory: dist | |||
run: zip -r leaflet.zip . | run: zip -r leaflet.zip . | |||
- name: Publish artifacts | - name: Publish artifacts | |||
uses: jakejarvis/s3-sync-action@v0.5.1 | uses: jakejarvis/s3-sync-action@v0.5.1 | |||
skipping to change at line 195 | skipping to change at line 197 | |||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |||
SOURCE_DIR: dist | SOURCE_DIR: dist | |||
DEST_DIR: content/leaflet/${{ github.ref_name }} | DEST_DIR: content/leaflet/${{ github.ref_name }} | |||
publish-npm: | publish-npm: | |||
needs: build | needs: build | |||
if: github.repository_owner == 'Leaflet' && startsWith(github.ref, 'refs/tag s/v') | if: github.repository_owner == 'Leaflet' && startsWith(github.ref, 'refs/tag s/v') | |||
runs-on: ubuntu-latest | runs-on: ubuntu-latest | |||
steps: | steps: | |||
- name: Restore build | - name: Restore build | |||
uses: actions/cache@v3.0.2 | uses: actions/cache@v3 | |||
with: | with: | |||
path: ./* | path: ./* | |||
key: ${{ runner.os }}-${{ github.sha }}-build | key: ${{ runner.os }}-${{ github.sha }}-build | |||
- name: Set up Node | - name: Set up Node | |||
uses: actions/setup-node@v3.1.0 | uses: actions/setup-node@v3 | |||
with: | with: | |||
node-version: ${{ env.NODE_VERSION }} | node-version: ${{ env.NODE_VERSION }} | |||
registry-url: https://registry.npmjs.org | registry-url: https://registry.npmjs.org | |||
- name: Publish to NPM | - name: Publish to NPM | |||
run: | | run: | | |||
TAG=$(echo $GITHUB_REF_NAME | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?') | TAG=$(echo $GITHUB_REF_NAME | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?') | |||
npm publish --tag ${TAG:-latest} | npm publish --tag ${TAG:-latest} | |||
env: | env: | |||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |||
End of changes. 19 change blocks. | ||||
18 lines changed or deleted | 20 lines changed or added |