Skip to content

Commit 4b0c5fb

Browse files
committed
Add pause functionality and update CI for npm publishing
1 parent 89ee942 commit 4b0c5fb

4 files changed

Lines changed: 65 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,25 @@ permissions:
1010
packages: write
1111

1212
jobs:
13+
update-version:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
version: ${{ steps.get_version.outputs.version }}
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Get version from tag
24+
id: get_version
25+
run: |
26+
VERSION=${GITHUB_REF#refs/tags/v}
27+
echo "version=$VERSION" >> $GITHUB_OUTPUT
28+
echo "Version: $VERSION"
29+
1330
goreleaser:
31+
needs: update-version
1432
runs-on: ubuntu-latest
1533
steps:
1634
- name: Checkout
@@ -24,6 +42,13 @@ jobs:
2442
go-version: '>=1.22.0'
2543
cache: true
2644

45+
- name: Update version in main.go
46+
run: |
47+
VERSION=${{ needs.update-version.outputs.version }}
48+
BUILD_DATE=$(date +%Y-%m-%d)
49+
sed -i "s/Version = \".*\"/Version = \"$VERSION\"/" main.go
50+
sed -i "s/BuildDate = \".*\"/BuildDate = \"$BUILD_DATE\"/" main.go
51+
2752
- name: Run GoReleaser
2853
uses: goreleaser/goreleaser-action@v4
2954
with:
@@ -33,3 +58,29 @@ jobs:
3358
env:
3459
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3560
TAP_GITHUB_TOKEN: ${{ secrets.TAP_GITHUB_TOKEN }}
61+
62+
npm-publish:
63+
needs: [update-version, goreleaser]
64+
runs-on: ubuntu-latest
65+
steps:
66+
- name: Checkout
67+
uses: actions/checkout@v3
68+
69+
- name: Setup Node.js
70+
uses: actions/setup-node@v3
71+
with:
72+
node-version: '18'
73+
registry-url: 'https://registry.npmjs.org'
74+
75+
- name: Update package.json version
76+
run: |
77+
VERSION=${{ needs.update-version.outputs.version }}
78+
npm version $VERSION --no-git-tag-version
79+
80+
- name: Install dependencies
81+
run: npm ci || npm install
82+
83+
- name: Publish to NPM
84+
run: npm publish
85+
env:
86+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
All notable changes to Term-Rex will be documented in this file.
44

5+
## [0.1.3] - 2025-05-11
6+
7+
### Added
8+
- Added pause functionality with 'P' key
9+
- Improved pause UI with clear visual indicators
10+
- Updated README to reflect pause feature
11+
12+
### Changed
13+
- Optimized game loop to handle pause state properly
14+
- Clouds continue to move during pause for visual effect
15+
- Refactored input handling for better code organization
16+
517
## [0.1.2] - 2025-05-11
618

719
### Added

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
// Version information
1414
const (
15-
Version = "0.1.2"
15+
Version = "0.1.3"
1616
BuildDate = "2025-05-11"
1717
)
1818

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "term-rex",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"description": "Terminal-based dinosaur runner game",
55
"bin": {
66
"term-rex": "./bin/term-rex"

0 commit comments

Comments
 (0)