diff --git a/.github/workflows/angular.yml b/.github/workflows/angular.yml new file mode 100644 index 00000000..f787223b --- /dev/null +++ b/.github/workflows/angular.yml @@ -0,0 +1,66 @@ +on: + workflow_call: + +env: + NODE_JS_VERSION: 16 + +jobs: + install-and-scan-deps: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: ${{env.NODE_JS_VERSION}} + cache: 'yarn' + - uses: actions/cache@v3 + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + path: '**/node_modules' + - run: yarn config get cacheFolder + - run: yarn --frozen-lockfile + - run: yarn run improved-yarn-audit --min-severity high || true + + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: ${{env.NODE_JS_VERSION}} + cache: 'yarn' + - uses: actions/cache@v3 + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + path: '**/node_modules' + - run: yarn config get cacheFolder + - run: yarn --frozen-lockfile + - run: yarn lint + needs: + - install-and-scan-deps + + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: ${{env.NODE_JS_VERSION}} + cache: 'yarn' + - uses: actions/cache@v3 + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + path: '**/node_modules' + - run: yarn --frozen-lockfile + - run: yarn build:lib + - run: yarn build:demo --base-href "/ngx-openlayers/" --progress false + - uses: actions/upload-artifact@v3 + with: + name: lib-build + path: dist/ngx-openlayers/ + - uses: actions/upload-artifact@v3 + with: + name: demo-build + path: dist/demo-ngx-openlayers/ + needs: + - install-and-scan-deps diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..12004a75 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,8 @@ +on: + push: + tags-ignore: + - '**' + +jobs: + angular: + uses: ./.github/workflows/angular.yml diff --git a/.github/workflows/tags.yml b/.github/workflows/tags.yml new file mode 100644 index 00000000..4e01de72 --- /dev/null +++ b/.github/workflows/tags.yml @@ -0,0 +1,75 @@ +on: + push: + tags: + - '*' + +jobs: + angular: + uses: ./.github/workflows/angular.yml + + release-lib-on-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v3 + with: + name: lib-build + path: dist/ngx-openlayers/ + - uses: actions/setup-node@v3 + with: + node-version: ${{env.NODE_JS_VERSION}} + cache: 'yarn' + registry-url: 'https://registry.npmjs.org' + - uses: actions/cache@v3 + with: + key: node_modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }} + path: '**/node_modules' + - run: cp projects/ngx-openlayers/CHANGELOG.md dist/ngx-openlayers/CHANGELOG.md + - run: cd dist/ngx-openlayers/ && npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + needs: + - angular + + release-lib-on-gh: + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v3 + with: + name: lib-build + path: dist/ngx-openlayers/ + - id: check-tag + run: | + if echo "${{ github.event.ref }}" | grep -Eq "^refs/tags/[0-9]+.[0-9]+.[0-9]+-.*$"; then + echo "prerelease=true" >> $GITHUB_OUTPUT + fi + - uses: ncipollo/release-action@v1 + with: + artifacts: "dist/ngx-openlayers/" + prerelease: ${{ steps.check-tag.outputs.prerelease == 'true' }} + needs: + - angular + + deploy-demo-on-gh-pages: + runs-on: ubuntu-latest + permissions: + contents: read + pages: write + id-token: write + steps: + - uses: actions/download-artifact@v3 + with: + name: demo-build + path: . + - uses: actions/upload-pages-artifact@v2 + with: + path: . + - uses: actions/deploy-pages@v2 + with: + name: demo-build + path: dist/demo-ngx-openlayers/ + needs: + - angular diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 68af36e8..00000000 --- a/.travis.yml +++ /dev/null @@ -1,75 +0,0 @@ -language: node_js -sudo: false -node_js: -- '10' -install: -- yarn -cache: - timeout: 3600 - yarn: true - directories: - - node_modules - - projects/ngx-openlayers/node_modules - - dist - -jobs: - include: - - stage: check - name: next lib linting - script: - - yarn lint - - - stage: build - name: next lib and demo - script: - - yarn build:lib - - cp -r dist/ngx-openlayers dist/ngx-openlayers-publish - - yarn build:demo --base-href "/ngx-openlayers/" --progress false - - - stage: release - name: next lib version on github releases - if: tag =~ /^\d+.\d+.\d+-next.\d+$/ - script: 'true' # skips tests - before_deploy: - - cd dist/ngx-openlayers-publish - - cp ../../projects/ngx-openlayers/CHANGELOG.md CHANGELOG.md - - npm pack - deploy: - - provider: releases - prerelease: true - api_key: $GITHUB_OAUTH_TOKEN - file_glob: true - file: '*.tgz' - skip_cleanup: true - on: - tags: true - - - stage: release - name: next demo on github pages - if: tag =~ /^\d+.\d+.\d+-next.\d+$/ - script: 'true' # skips tests - before_deploy: - - cd dist/demo-ngx-openlayers - deploy: - - provider: pages - local_dir: dist/demo-ngx-openlayers - skip_cleanup: true - github_token: $GITHUB_OAUTH_TOKEN - on: - tags: true - - - stage: deploy - name: next lib version on npm - if: tag =~ /^\d+.\d+.\d+-next.\d+$/ - script: 'true' # skips tests - before_deploy: - - cp projects/ngx-openlayers/CHANGELOG.md dist/ngx-openlayers-publish/CHANGELOG.md - - cd dist/ngx-openlayers-publish - deploy: - - provider: npm - email: $NPM_EMAIL - api_key: $NPM_TOKEN - tag: next - skip_cleanup: true - on: - tags: true diff --git a/package.json b/package.json index 9364f17c..5a796190 100644 --- a/package.json +++ b/package.json @@ -47,6 +47,7 @@ "eslint-plugin-import": "latest", "eslint-plugin-jsdoc": "latest", "eslint-plugin-prefer-arrow": "latest", + "improved-yarn-audit": "^3.0.0", "jasmine-core": "~4.3.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.4.1", diff --git a/yarn.lock b/yarn.lock index 8ccca1fd..4c4ff8b9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5351,6 +5351,11 @@ import-fresh@^3.0.0, import-fresh@^3.2.1: parent-module "^1.0.0" resolve-from "^4.0.0" +improved-yarn-audit@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/improved-yarn-audit/-/improved-yarn-audit-3.0.0.tgz#dfb09cea1a3a92c790ea2b4056431f6fb1b99bfa" + integrity sha512-b7CrBYYwMidtPciCBkW62C7vqGjAV10bxcAWHeJvGrltrcMSEnG5I9CQgi14nmAlUKUQiSvpz47Lo3d7Z3Vjcg== + imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea"