Skip to content
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

chore(release): v0.2.1 #20

Merged
merged 3 commits into from
Oct 2, 2024
Merged
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
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"
}
}