Skip to content

Commit c7af05d

Browse files
committed
chore: git workflow and bump version
1 parent 176c91a commit c7af05d

3 files changed

Lines changed: 112 additions & 1 deletion

File tree

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Lint, Test, and Build
2+
3+
on:
4+
release:
5+
types: [created]
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
node-version: [20]
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Use Node.js ${{ matrix.node-version }}
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: ${{ matrix.node-version }}
22+
- name: Install dependencies
23+
run: npm install
24+
- name: Lint
25+
run: npm run lint
26+
- name: Test
27+
run: npm run test
28+
- name: Build
29+
run: npm run build

.github/workflows/publish.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Publish Package
2+
3+
on:
4+
pull_request:
5+
types:
6+
- closed
7+
branches:
8+
- main
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
if: github.event.pull_request.merged == true
14+
strategy:
15+
matrix:
16+
node-version: [20]
17+
steps:
18+
- uses: actions/checkout@v4
19+
- name: Use Node.js ${{ matrix.node-version }}
20+
uses: actions/setup-node@v4
21+
with:
22+
node-version: ${{ matrix.node-version }}
23+
- name: Install dependencies
24+
run: npm install
25+
- name: Lint
26+
run: npm run lint
27+
- name: Build
28+
run: npm run build
29+
30+
check-version:
31+
runs-on: ubuntu-latest
32+
needs: [build]
33+
if: github.event.pull_request.merged == true
34+
outputs:
35+
version-updated: ${{ steps.compare-versions.outputs.version-updated }}
36+
steps:
37+
- name: Checkout main branch at commit before merge
38+
uses: actions/checkout@v4
39+
with:
40+
ref: ${{ github.event.pull_request.base.sha }}
41+
42+
- name: Get version before merge
43+
id: pre-merge-version
44+
run: |
45+
PRE_MERGE_VERSION=$(node -p "require('./package.json').version")
46+
echo "pre_merge_version=$PRE_MERGE_VERSION" >> "$GITHUB_OUTPUT"
47+
48+
- name: Checkout main branch at commit after merge
49+
uses: actions/checkout@v4
50+
with:
51+
ref: main
52+
53+
- name: Get version after merge
54+
id: post-merge-version
55+
run: |
56+
POST_MERGE_VERSION=$(node -p "require('./package.json').version")
57+
echo "post_merge_version=$POST_MERGE_VERSION" >> "$GITHUB_OUTPUT"
58+
59+
- name: Compare versions
60+
id: compare-versions
61+
run: |
62+
if [[ "${{ steps.pre-merge-version.outputs.pre_merge_version }}" != "${{ steps.post-merge-version.outputs.post_merge_version }}" ]]; then
63+
echo "version-updated=true" >> "$GITHUB_OUTPUT"
64+
else
65+
echo "version-updated=false" >> "$GITHUB_OUTPUT"
66+
fi
67+
68+
publish:
69+
needs: [build, check-version]
70+
if: needs.check-version.outputs.version-updated == 'true'
71+
runs-on: ubuntu-latest
72+
steps:
73+
- uses: actions/checkout@v4
74+
- uses: actions/setup-node@v4
75+
with:
76+
node-version: 20
77+
registry-url: https://registry.npmjs.org/
78+
- run: npm install
79+
- run: npm run build
80+
- run: npm publish --access public
81+
env:
82+
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@meshsdk/contract",
3-
"version": "1.9.0-beta.87",
3+
"version": "1.9.0-beta.103",
44
"description": "List of open-source smart contracts, complete with documentation, live demos, and end-to-end source code. https://meshjs.dev/smart-contracts",
55
"main": "./dist/index.cjs",
66
"browser": "./dist/index.js",

0 commit comments

Comments
 (0)