Skip to content

Commit d8a05a4

Browse files
committed
Add README.md for project documentation and update publish workflow to trigger on semantic version tags
1 parent 5bed224 commit d8a05a4

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ name: Publish package
22

33
on:
44
push:
5-
branches:
6-
- main
7-
workflow_dispatch:
5+
tags:
6+
- 'v*'
87

98
permissions:
109
contents: read
@@ -32,6 +31,15 @@ jobs:
3231
- name: Install dependencies
3332
run: pnpm install --frozen-lockfile
3433

34+
- name: Set package version from tag
35+
run: |
36+
VERSION="${GITHUB_REF_NAME#v}"
37+
if ! [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$ ]]; then
38+
echo "Tag must be a semantic version prefixed with v (for example, v1.2.3)."
39+
exit 1
40+
fi
41+
pnpm version "$VERSION" --no-git-tag-version
42+
3543
- name: Build package
3644
run: pnpm run build
3745

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# @originprotocol/squid-utils
2+
3+
Shared utilities for Origin Protocol Subsquid projects.
4+
5+
## Publishing
6+
7+
Packages are published to GitHub Packages by the `Publish package` GitHub
8+
Actions workflow.
9+
10+
1. Create a GitHub Release with a semantic-version tag such as `v1.2.3`.
11+
2. Publish the release. Creating the tag triggers the publish workflow.
12+
3. The workflow removes the `v` prefix, sets the package version to `1.2.3`,
13+
builds the package, and publishes it to GitHub Packages.
14+
15+
Each version can be published only once. Use a new tag for every release.

0 commit comments

Comments
 (0)