Skip to content

Commit

Permalink
ci: switch from travis to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Neonox31 committed Nov 30, 2023
1 parent 2eced8b commit c8fd143
Show file tree
Hide file tree
Showing 7 changed files with 2,014 additions and 1,932 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/angular.yml
Original file line number Diff line number Diff line change
@@ -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

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
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
on:
push:
branches:
- '**'
tags-ignore:
- '**'

jobs:
angular:
uses: ./.github/workflows/angular.yml
76 changes: 76 additions & 0 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
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:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
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
id: deployment
needs:
- angular
75 changes: 0 additions & 75 deletions .travis.yml

This file was deleted.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "^5.36.2",
"@typescript-eslint/parser": "^5.36.2",
"commit-and-tag-version": "^11.0.0",
"eslint": "^8.23.0",
"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",
Expand All @@ -57,8 +59,10 @@
"ng-packagr": "^14.2.2",
"prettier": "^2.0.3",
"protractor": "~7.0.0",
"standard-version": "^7.1.0",
"ts-node": "~8.3.0",
"typescript": "~4.7.2"
},
"volta": {
"node": "16.20.2"
}
}
8 changes: 5 additions & 3 deletions projects/ngx-openlayers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
"name": "ngx-openlayers",
"version": "1.0.0-next.19",
"scripts": {
"release": "standard-version -m \"chore(release): version %s\" -t \"\" --prerelease next"
"release": "commit-and-tag-version -m \"chore(release): version %s\" -t \"\" --prerelease next"
},
"standard-version": {
"postchangelog": "cp projects/ngx-openlayers/CHANGELOG.md dist/ngx-openlayers/CHANGELOG.md"
"commit-and-tag-version": {
"scripts": {
"postchangelog": "cp projects/ngx-openlayers/CHANGELOG.md dist/ngx-openlayers/CHANGELOG.md"
}
},
"peerDependencies": {
"@angular/common": ">=6.0.0 <=14.x.x",
Expand Down
Loading

0 comments on commit c8fd143

Please sign in to comment.