Skip to content

Commit 84e8464

Browse files
committed
Migrate to GH Actions
1 parent 2211c8c commit 84e8464

File tree

8 files changed

+174
-120
lines changed

8 files changed

+174
-120
lines changed

.circleci/config.yml

Lines changed: 0 additions & 111 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.

.circleci/publish.js renamed to .github/publish.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@ if (args.length && args[0].trim().length > 0) {
66
tag = args[0];
77
}
88

9-
ghpages.publish('build/', {
9+
const options = {
1010
src: '**',
1111
dest: tag,
1212
message: 'Publish JSON Schemas [ci skip]',
1313
user: {
1414
name: 'STAC CI',
1515
1616
}
17-
}, error => {
17+
};
18+
19+
// Use GITHUB_TOKEN for authentication in CI environment
20+
if (process.env.GITHUB_TOKEN) {
21+
const repo = process.env.GITHUB_REPOSITORY || 'radiantearth/stac-api-spec';
22+
options.repo = `https://x-access-token:${process.env.GITHUB_TOKEN}@github.com/${repo}.git`;
23+
}
24+
25+
ghpages.publish('build/', options, error => {
1826
console.error(error ? error : 'Deployed to gh-pages');
1927
process.exit(error ? 1 : 0);
2028
});

.github/workflows/publish.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
validate:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: '16.14'
19+
cache: 'npm'
20+
21+
- name: Install dependencies
22+
run: npm install
23+
24+
- name: Run validation
25+
run: npm run check
26+
27+
build:
28+
runs-on: ubuntu-latest
29+
needs: validate
30+
steps:
31+
- name: Checkout code
32+
uses: actions/checkout@v4
33+
34+
- name: Setup Node.js
35+
uses: actions/setup-node@v4
36+
with:
37+
node-version: 'lts/*'
38+
cache: 'npm'
39+
40+
- name: Install dependencies
41+
run: npm install
42+
43+
- name: Build OpenAPI
44+
run: npm run build-openapi
45+
46+
- name: Upload build artifacts
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: build
50+
path: build/
51+
52+
publish:
53+
runs-on: ubuntu-latest
54+
needs: build
55+
permissions:
56+
contents: write
57+
steps:
58+
- name: Checkout code
59+
uses: actions/checkout@v4
60+
61+
- name: Setup Node.js
62+
uses: actions/setup-node@v4
63+
with:
64+
node-version: 'lts/*'
65+
cache: 'npm'
66+
67+
- name: Install dependencies
68+
run: npm install
69+
70+
- name: Download build artifacts
71+
uses: actions/download-artifact@v4
72+
with:
73+
name: build
74+
path: build/
75+
76+
- name: Configure git
77+
run: |
78+
git config --global user.name "STAC CI"
79+
git config --global user.email "[email protected]"
80+
81+
- name: Publish to gh-pages
82+
env:
83+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
84+
run: |
85+
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
86+
TAG="${{ github.ref_name }}"
87+
else
88+
TAG="main"
89+
fi
90+
npm run publish-openapi -- $TAG

.github/workflows/test.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
validate:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v4
18+
with:
19+
node-version: 'lts/*'
20+
cache: 'npm'
21+
22+
- name: Install dependencies
23+
run: npm install
24+
25+
- name: Run validation
26+
run: npm run check
27+
28+
build:
29+
runs-on: ubuntu-latest
30+
needs: validate
31+
steps:
32+
- name: Checkout code
33+
uses: actions/checkout@v4
34+
35+
- name: Setup Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: 'lts/*'
39+
cache: 'npm'
40+
41+
- name: Install dependencies
42+
run: npm install
43+
44+
- name: Build OpenAPI
45+
run: npm run build-openapi
46+
47+
check-core-changes:
48+
runs-on: ubuntu-latest
49+
needs: validate
50+
if: github.event_name == 'pull_request'
51+
steps:
52+
- name: Checkout code
53+
uses: actions/checkout@v4
54+
with:
55+
fetch-depth: 0
56+
57+
- name: Setup Node.js
58+
uses: actions/setup-node@v4
59+
with:
60+
node-version: 'lts/*'
61+
cache: 'npm'
62+
63+
- name: Install dependencies
64+
run: npm install
65+
66+
- name: Check STAC spec changes
67+
run: npm run check-stac-spec-changes --compare-to=${{ github.event.pull_request.base.sha }}

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
"check": "npm run check-markdown && npm run check-openapi",
1010
"check-markdown": "remark . --frail --ignore-pattern stac-spec/",
1111
"check-openapi": "npm run check-openapi-core && npm run check-openapi-commons && npm run check-openapi-ogcapi-features && npm run check-openapi-item-search && npm run check-openapi-fragments",
12-
"check-openapi-core": "spectral lint core/openapi.yaml --ruleset .circleci/.spectral.yml",
13-
"check-openapi-commons": "spectral lint core/commons.yaml --ruleset .circleci/.spectral-fragments.yml",
14-
"check-openapi-ogcapi-features": "spectral lint ogcapi-features/openapi-features.yaml ogcapi-features/openapi-collections.yaml --ruleset .circleci/.spectral.yml",
15-
"check-openapi-item-search": "spectral lint item-search/openapi.yaml --ruleset .circleci/.spectral.yml",
16-
"check-openapi-fragments": "spectral lint fragments/*/openapi.yaml --ruleset .circleci/.spectral-fragments.yml",
17-
"build-openapi": ".circleci/build-openapi.sh",
18-
"publish-openapi": "node .circleci/publish.js",
12+
"check-openapi-core": "spectral lint core/openapi.yaml --ruleset .github/.spectral.yml",
13+
"check-openapi-commons": "spectral lint core/commons.yaml --ruleset .github/.spectral-fragments.yml",
14+
"check-openapi-ogcapi-features": "spectral lint ogcapi-features/openapi-features.yaml ogcapi-features/openapi-collections.yaml --ruleset .github/.spectral.yml",
15+
"check-openapi-item-search": "spectral lint item-search/openapi.yaml --ruleset .github/.spectral.yml",
16+
"check-openapi-fragments": "spectral lint fragments/*/openapi.yaml --ruleset .github/.spectral-fragments.yml",
17+
"build-openapi": ".github/build-openapi.sh",
18+
"publish-openapi": "node .github/publish.js",
1919
"check-stac-spec-changes": "git diff --quiet HEAD ${npm_config_compare_to} -- stac-spec"
2020
},
2121
"dependencies": {

0 commit comments

Comments
 (0)