Skip to content

Commit f3a97ab

Browse files
Merge pull request #465 from geotiffjs/themrcam/ci-suggestions
2 parents 234254c + 5168ee2 commit f3a97ab

File tree

5 files changed

+129
-19
lines changed

5 files changed

+129
-19
lines changed

.github/changelog.json

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"categories": [
3+
{
4+
"title": "## Breaking",
5+
"labels": ["breaking"]
6+
},
7+
{
8+
"title": "## Features",
9+
"labels": ["feature", "enhancement"]
10+
},
11+
{
12+
"title": "## Fixes",
13+
"labels": ["fix", "bugfix"]
14+
},
15+
{
16+
"title": "## Documentation",
17+
"labels": ["documentation", "docs"]
18+
},
19+
{
20+
"title": "## Infrastructure",
21+
"labels": ["dependencies", "maintenance", "ci"]
22+
},
23+
{
24+
"title": "## Uncategorized",
25+
"labels": []
26+
}
27+
],
28+
"ignore_labels": ["ignore", "ci-ignore"],
29+
"template": "#{{CHANGELOG}}",
30+
"pr_template": "- #{{TITLE}} (##{{NUMBER}} by @#{{AUTHOR}})"
31+
}

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ jobs:
1010
ci:
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v4
1414
- run: |
1515
docker pull ghcr.io/osgeo/gdal:ubuntu-small-latest ;
1616
docker run -i --rm -v `pwd`/test/data:/data ghcr.io/osgeo/gdal:ubuntu-small-latest bash -c "apt-get update && apt-get -y install imagemagick libtiff-tools wget && cd /data && ./setup_data.sh"
1717
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/setup-node@v1
18+
uses: actions/setup-node@v4
1919
with:
20-
node-version: 20.x
21-
- run: npm ci
20+
node-version: 22.x
21+
- run: npm ci --ignore-scripts
22+
- run: npm rebuild
2223
- run: npm run build
2324
- run: npm test
2425
- name: action-slack

.github/workflows/docs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ jobs:
1010
runs-on: ubuntu-latest
1111
steps:
1212
- name: Checkout code
13-
uses: actions/checkout@v2
14-
- name: Use Node.js ${{ matrix.node-version }}
15-
uses: actions/setup-node@v1
13+
uses: actions/checkout@v4
14+
- name: Use Node.js 22.x
15+
uses: actions/setup-node@v4
1616
with:
17-
node-version: ${{ matrix.node-version }}
17+
node-version: 22.x
1818
- run: npm ci
1919
- run: npm run docs
2020
- name: Deploy pages

.github/workflows/release.yml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,49 @@ on:
77

88
jobs:
99
release:
10-
name: Create Release
10+
name: Create release
1111
runs-on: ubuntu-latest
12+
13+
permissions:
14+
# required for softprops/action-gh-release
15+
contents: write
16+
# required for mikepenz/release-changelog-builder-action
17+
pull-requests: read
18+
1219
steps:
1320
- name: Checkout code
14-
uses: actions/checkout@v2
15-
- run: npm install
21+
uses: actions/checkout@v4
22+
- run: npm ci --ignore-scripts
23+
# npm run prepare runs the build step for publish and pack
24+
- run: npm rebuild && npm run prepare
1625
- run: npm run docs
17-
- uses: JS-DevTools/npm-publish@v1
26+
- uses: JS-DevTools/npm-publish@v3
27+
id: publish
1828
with:
1929
token: ${{ secrets.NPM_TOKEN }}
20-
- name: Create Release
30+
- name: Create release notes
31+
id: build_changelog
32+
uses: mikepenz/release-changelog-builder-action@v5
33+
with:
34+
configuration: '.github/changelog.json'
35+
ignorePreReleases: ${{ ! contains(github.ref_name, '-') }}
36+
- name: Create tarball
37+
run: npm pack --ignore-scripts
38+
- name: Create release
2139
id: create_release
22-
uses: actions/create-release@v1
23-
env:
24-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
uses: softprops/action-gh-release@v2
2541
with:
2642
tag_name: ${{ github.ref }}
27-
release_name: Release ${{ github.ref }}
28-
body: ""
43+
name: Release ${{ github.ref_name }}
44+
body: |
45+
${{ steps.build_changelog.outputs.changelog }}
46+
47+
**${{ contains(github.ref_name, '-') && 'Prerelease' || 'Full' }} changelog:** ${{ github.server_url }}/${{ github.repository }}/compare/${{ steps.build_changelog.outputs.fromTag }}...${{ steps.build_changelog.outputs.toTag }}
48+
**NPM release:** https://npmjs.com/package/${{ steps.publish.outputs.name }}/v/${{ steps.publish.outputs.version }}
2949
draft: true
30-
prerelease: false
50+
prerelease: ${{ contains(github.ref_name, '-') }}
51+
files: |
52+
*.tgz
3153
- name: action-slack
3254
uses: 8398a7/[email protected]
3355
with:

.github/workflows/version.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Create and push the commit and tag created from npm version <version>
2+
#
3+
# From the Actions page on GitHub, users (with write permissions) can select
4+
# the desired release <version> and this action will handle running npm version
5+
# and pushing the tag to the repository.
6+
#
7+
# Due to the VERSION_TOKEN, the tag push will trigger release.yml, which handles
8+
# releasing to npm and GitHub releases.
9+
#
10+
# With pre* versions (prerelease, prepatch, etc.), the tag will be created with
11+
# --preid beta. Currently, they are released normally, to --tag latest on npm.
12+
13+
name: Push new version
14+
15+
on:
16+
workflow_dispatch:
17+
inputs:
18+
version:
19+
description: 'npm version semver level'
20+
required: true
21+
default: 'patch'
22+
type: choice
23+
options:
24+
- patch
25+
- minor
26+
- major
27+
- prerelease
28+
- prepatch
29+
- preminor
30+
- premajor
31+
32+
jobs:
33+
version:
34+
name: Push ${{ inputs.version }} tag
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout branch
39+
uses: actions/checkout@v4
40+
with:
41+
# see https://github.com/orgs/community/discussions/25617#discussioncomment-3248494
42+
token: ${{ secrets.VERSION_TOKEN }}
43+
# requires contents: write permission for this repo
44+
# used by `git push` at the end
45+
- uses: actions/setup-node@v4
46+
with:
47+
node-version: 22.x
48+
- name: Configure git user
49+
# this step is necessary for `npm version` to succeed
50+
run: |
51+
git config --global user.name "${{ github.actor }}"
52+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
53+
- name: npm version ${{ inputs.version }}
54+
run: echo "version=$(npm version ${{ inputs.version }}${{ startsWith(inputs.version, 'pre') && '--preid beta' || '' }})" >> "$GITHUB_ENV"
55+
- name: git push
56+
run: git push && git push origin ${{ env.version }}

0 commit comments

Comments
 (0)