Skip to content

Commit

Permalink
chore(release): v0.2.1 (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
donmccurdy authored Oct 2, 2024
1 parent 125a822 commit 29f8516
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
36 changes: 12 additions & 24 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,45 +11,35 @@ jobs:
name: Release
runs-on: ubuntu-22.04

# Fetching tags: https://stackoverflow.com/a/76181083
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10
fetch-tags: true

# Step output: https://stackoverflow.com/a/65616499
# Reading latest tag: https://stackoverflow.com/a/33733020
- name: Read git tag
id: git-tag
run: echo "TAG_NAME=$(git tag --points-at HEAD)" >> $GITHUB_OUTPUT

- name: Verify git tag
env:
GIT_TAG: ${{ steps.git-tag.outputs.TAG_NAME }}
if: startsWith(env.GIT_TAG, 'v') == false
run: echo "Missing or invalid git tag; aborting" && exit 1
# Read version from 'package.json'; git tags are lost on a merged PR.
- name: Read package version
id: version
run: echo "PKG_VERSION=v$(npm pkg get version | xargs)" >> $GITHUB_OUTPUT

- name: Set up Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

# Determine whether to tag the release as 'latest' or 'alpha'.
- name: Assign dist tag
id: dist-tag
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const gitTag = '${{ steps.git-tag.outputs.TAG_NAME }}'
console.log(`git tag: ${gitTag}`)
if (gitTag.match(/^v\d+\.\d+\.\d+$/)) {
const version = '${{ steps.version.outputs.PKG_VERSION }}'
console.log(`version: ${version}`)
if (version.match(/^v\d+\.\d+\.\d+$/)) {
distTag = 'latest'
} else if (gitTag.match(/^v\d+\.\d+\.\d+/)) {
} else if (version.match(/^v\d+\.\d+\.\d+/)) {
distTag = 'alpha'
} else {
core.setFailed('Tag must follow SemVer convention. Aborting.');
core.setFailed('Version must follow SemVer convention. Aborting.');
}
console.log(`npm dist tag: ${distTag}`)
return distTag
Expand All @@ -59,11 +49,9 @@ jobs:
corepack enable
yarn install
# Build. Tests are run automatically by `yarn prepublish`.
- name: Build
run: |
yarn lint
yarn build
yarn test
run: yarn build

- name: Configure yarn to publish packages
env:
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"repository": "github:CartoDB/carto-api-client",
"author": "Don McCurdy <[email protected]>",
"packageManager": "[email protected]",
"version": "0.2.1-alpha.12",
"version": "0.2.1",
"license": "MIT",
"publishConfig": {
"access": "public",
Expand Down Expand Up @@ -98,6 +98,5 @@
"@turf/invariant": "^7.1.0",
"@turf/union": "^7.1.0",
"@types/geojson": "^7946.0.14"
},
"stableVersion": "0.2.0"
}
}

0 comments on commit 29f8516

Please sign in to comment.