Skip to content

Workflow updates & release improvements #465

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/changelog.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"categories": [
{
"title": "## Breaking",
"labels": ["breaking"]
},
{
"title": "## Features",
"labels": ["feature", "enhancement"]
},
{
"title": "## Fixes",
"labels": ["fix", "bugfix"]
},
{
"title": "## Documentation",
"labels": ["documentation", "docs"]
},
{
"title": "## Infrastructure",
"labels": ["dependencies", "maintenance", "ci"]
},
{
"title": "## Uncategorized",
"labels": []
}
],
"ignore_labels": ["ignore", "ci-ignore"],
"template": "#{{CHANGELOG}}",
"pr_template": "- #{{TITLE}} (##{{NUMBER}} by @#{{AUTHOR}})"
}
9 changes: 5 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- run: |
docker pull ghcr.io/osgeo/gdal:ubuntu-small-latest ;
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"
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: 20.x
- run: npm ci
node-version: 22.x
- run: npm ci --ignore-scripts
- run: npm rebuild
- run: npm run build
- run: npm test
- name: action-slack
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/checkout@v4
- name: Use Node.js 22.x
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 22.x
- run: npm ci
- run: npm run docs
- name: Deploy pages
Expand Down
44 changes: 33 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,49 @@ on:

jobs:
release:
name: Create Release
name: Create release
runs-on: ubuntu-latest

permissions:
# required for softprops/action-gh-release
contents: write
# required for mikepenz/release-changelog-builder-action
pull-requests: read

steps:
- name: Checkout code
uses: actions/checkout@v2
- run: npm install
uses: actions/checkout@v4
- run: npm ci --ignore-scripts
# npm run prepare runs the build step for publish and pack
- run: npm rebuild && npm run prepare
- run: npm run docs
- uses: JS-DevTools/npm-publish@v1
- uses: JS-DevTools/npm-publish@v3
id: publish
with:
token: ${{ secrets.NPM_TOKEN }}
- name: Create Release
- name: Create release notes
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v5
with:
configuration: '.github/changelog.json'
ignorePreReleases: ${{ ! contains(github.ref_name, '-') }}
- name: Create tarball
run: npm pack --ignore-scripts
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: ""
name: Release ${{ github.ref_name }}
body: |
${{ steps.build_changelog.outputs.changelog }}

**${{ contains(github.ref_name, '-') && 'Prerelease' || 'Full' }} changelog:** ${{ github.server_url }}/${{ github.repository }}/compare/${{ steps.build_changelog.outputs.fromTag }}...${{ steps.build_changelog.outputs.toTag }}
**NPM release:** https://npmjs.com/package/${{ steps.publish.outputs.name }}/v/${{ steps.publish.outputs.version }}
draft: true
prerelease: false
prerelease: ${{ contains(github.ref_name, '-') }}
files: |
*.tgz
- name: action-slack
uses: 8398a7/[email protected]
with:
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Create and push the commit and tag created from npm version <version>
#
# From the Actions page on GitHub, users (with write permissions) can select
# the desired release <version> and this action will handle running npm version
# and pushing the tag to the repository.
#
# Due to the VERSION_TOKEN, the tag push will trigger release.yml, which handles
# releasing to npm and GitHub releases.
#
# With pre* versions (prerelease, prepatch, etc.), the tag will be created with
# --preid beta. Currently, they are released normally, to --tag latest on npm.

name: Push new version

on:
workflow_dispatch:
inputs:
version:
description: 'npm version semver level'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
- prerelease
- prepatch
- preminor
- premajor

jobs:
version:
name: Push ${{ inputs.version }} tag
runs-on: ubuntu-latest

steps:
- name: Checkout branch
uses: actions/checkout@v4
with:
# see https://github.com/orgs/community/discussions/25617#discussioncomment-3248494
token: ${{ secrets.VERSION_TOKEN }}
# requires contents: write permission for this repo
# used by `git push` at the end
- uses: actions/setup-node@v4
with:
node-version: 22.x
- name: Configure git user
# this step is necessary for `npm version` to succeed
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
- name: npm version ${{ inputs.version }}
run: echo "version=$(npm version ${{ inputs.version }}${{ startsWith(inputs.version, 'pre') && '--preid beta' || '' }})" >> "$GITHUB_ENV"
- name: git push
run: git push && git push origin ${{ env.version }}