Skip to content

Commit c36c996

Browse files
committed
fix: github action to include miner/ case, script to include lotus version without lotus prefix, removed instructions that include X.X.X
1 parent 3586556 commit c36c996

File tree

4 files changed

+71
-27
lines changed

4 files changed

+71
-27
lines changed

.github/workflows/update-versions.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,23 @@ jobs:
1919
- name: Get latest Lotus version
2020
id: get-version
2121
run: |
22-
LATEST_VERSION=$(curl -s https://api.github.com/repos/filecoin-project/lotus/releases/latest | jq -r .tag_name | sed 's/^v//')
22+
# Get the latest release info
23+
RELEASE_INFO=$(curl -s https://api.github.com/repos/filecoin-project/lotus/releases/latest)
24+
25+
# Extract the tag name
26+
TAG_NAME=$(echo "$RELEASE_INFO" | jq -r .tag_name)
27+
28+
# Handle different tag formats
29+
if [[ $TAG_NAME == *"miner"* ]]; then
30+
# For miner tags, extract everything after 'v'
31+
LATEST_VERSION=$(echo $TAG_NAME | sed -E 's/.*v([^/]*).*/\1/')
32+
else
33+
# For standard tags (e.g., v1.31.1)
34+
LATEST_VERSION=$(echo $TAG_NAME | sed 's/^v//')
35+
fi
36+
2337
echo "LATEST_VERSION=$LATEST_VERSION" >> $GITHUB_ENV
38+
echo "TAG_NAME=$TAG_NAME" >> $GITHUB_ENV
2439
2540
- name: Run update script
2641
run: |
@@ -34,6 +49,9 @@ jobs:
3449
body: |
3550
Automated PR to update Lotus version references to ${{ env.LATEST_VERSION }}
3651
52+
Original tag: ${{ env.TAG_NAME }}
53+
Extracted version: ${{ env.LATEST_VERSION }}
54+
3755
This PR updates all references of:
3856
- `lotus-X.X.X`
3957
- Previous lotus version numbers

nodes/full-nodes/basic-setup.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,29 @@ To install Lotus on your computer, follow these steps:
1212
2. Once you have downloaded the binary file, extract the contents to a directory of your choice. For example, if you are using Linux, you can extract the contents to the `/usr/local/bin directory` by running the command:
1313

1414
```sh
15-
sudo tar -C /usr/local/bin -xzf lotus-1.31.3-linux-amd64.tar.gz
15+
sudo tar -C /usr/local/bin -xzf lotus-1.31.1-linux-amd64.tar.gz
1616
```
1717

18-
3. Replace `X.X.X` with the version number of the release you downloaded.
19-
4. After extracting the contents, navigate to the `lotus` directory in your terminal. For example, if you extracted the contents to `/usr/local/bin`, you can navigate to the lotus directory by running the command:
18+
3. After extracting the contents, navigate to the `lotus` directory in your terminal. For example, if you extracted the contents to `/usr/local/bin`, you can navigate to the lotus directory by running the command:
2019

2120
```sh
22-
cd /usr/local/bin/lotus-1.31.3
21+
cd /usr/local/bin/lotus-1.31.1
2322
```
2423

25-
5. Again, replace `X.X.X` with the version number of the release you downloaded.
26-
6. Run the `lotus` binary file to start the Lotus daemon. You can do this by running the command:
24+
4. Run the `lotus` binary file to start the Lotus daemon. You can do this by running the command:
2725

2826
```sh
2927
./lotus daemon
3028
```
3129

32-
7. This will start the Lotus daemon, which will connect to the Filecoin network and start synchronizing with other nodes on the network.
33-
8. Optionally, you can also run the lotus-miner binary file if you want to participate in the Filecoin mining process. You can do this by running the command:
30+
5. This will start the Lotus daemon, which will connect to the Filecoin network and start synchronizing with other nodes on the network.
31+
6. Optionally, you can also run the lotus-miner binary file if you want to participate in the Filecoin mining process. You can do this by running the command:
3432

3533
```sh
3634
./lotus-miner run
3735
```
3836

39-
9. This will start the Lotus miner, which will use your computer’s computing power to mine new blocks on the Filecoin network.
37+
7. This will start the Lotus miner, which will use your computer’s computing power to mine new blocks on the Filecoin network.
4038

4139

4240

nodes/lite-nodes/spin-up-a-lite-node.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@ Before we can build the Lotus binaries, we need to follow a few pre-build steps.
7373
This should output something like:
7474

7575
```output
76-
v1.29.0
76+
v1.31.1
7777
```
7878
3. Using the value returned from the previous command, checkout to the latest release branch:
7979

8080
```shell
81-
git checkout v1.29.0
81+
git checkout v1.31.1
8282
```
8383
4. Done! You can move on to the [Build](https://docs.filecoin.io/nodes/lite-nodes/spin-up-a-lite-node/#build-the-binary) section.
8484
{% endtab %}
@@ -99,12 +99,12 @@ Before we can build the Lotus binaries, we need to follow a few pre-build steps.
9999
This should output something like:
100100

101101
```output
102-
v1.29.0
102+
v1.31.1
103103
```
104104
3. Using the value returned from the previous command, checkout to the latest release branch:
105105

106106
```shell
107-
git checkout v1.29.0
107+
git checkout v1.31.1
108108
```
109109
4. Create the necessary environment variables to allow Lotus to run on M1 architecture:
110110

@@ -132,12 +132,12 @@ Before we can build the Lotus binaries, we need to follow a few pre-build steps.
132132
This should output something like:
133133

134134
```output
135-
v1.29.0
135+
v1.31.1
136136
```
137137
3. Using the value returned from the previous command, checkout to the latest release branch:
138138

139139
```shell
140-
git checkout v1.29.0
140+
git checkout v1.31.1
141141
```
142142
4. If your processor was released later than an AMD Zen or Intel Ice Lake CPU, enable SHA extensions by adding these two environment variables. If in doubt, ignore this command and move on to [the next section](https://docs.filecoin.io/nodes/lite-nodes/spin-up-a-lite-node/#build-the-binary).
143143

@@ -175,7 +175,7 @@ The last thing we need to do to get our node setup is to build the package. The
175175
This will output something like:
176176

177177
```plaintext
178-
lotus version 1.29.0+mainnet+git.1ff3b360b
178+
lotus version 1.31.1+mainnet+git.1ff3b360b
179179
```
180180
{% endtab %}
181181

@@ -200,7 +200,7 @@ The last thing we need to do to get our node setup is to build the package. The
200200
This will output something like:
201201

202202
```plaintext
203-
lotus version 1.29.0+calibnet+git.1ff3b360b
203+
lotus version 1.31.1+calibnet+git.1ff3b360b
204204
```
205205
{% endtab %}
206206
{% endtabs %}

update-versions.js

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,55 @@ const getAllFiles = (dirPath, arrayOfFiles = []) => {
3030

3131
function processFiles() {
3232
const files = getAllFiles('.');
33-
// Regex patterns for both actual versions and X.X.X pattern
34-
const versionRegex = /lotus-(\d+\.\d+\.\d+|X\.X\.X)/g;
33+
let versionToUpdate = null;
3534

35+
// First pass: find the lotus-x.xx.x version
36+
files.forEach(file => {
37+
try {
38+
const content = fs.readFileSync(file, 'utf8');
39+
const lotusVersionMatch = content.match(/lotus-(\d+\.\d+\.\d+)/);
40+
41+
if (lotusVersionMatch) {
42+
versionToUpdate = lotusVersionMatch[1];
43+
console.log(`Found lotus version to update: ${versionToUpdate}`);
44+
return false; // Exit the forEach loop once we find a version
45+
}
46+
} catch (error) {
47+
console.error(`Error reading ${file}:`, error);
48+
}
49+
});
50+
51+
if (!versionToUpdate) {
52+
console.error('No lotus version found in files');
53+
return;
54+
}
55+
56+
// Second pass: update all occurrences of the version
3657
files.forEach(file => {
3758
try {
3859
const content = fs.readFileSync(file, 'utf8');
3960
let processed = content;
61+
62+
// Create regex to match the version with optional lotus- prefix
63+
const versionRegex = new RegExp(`(lotus-)?${versionToUpdate.replace(/\./g, '\\.')}`, 'g');
4064

41-
// Find all version patterns in the file
4265
const matches = content.match(versionRegex);
4366
if (matches) {
44-
matches.forEach(oldVersionString => {
45-
const newVersionString = `lotus-${NEW_VERSION}`;
46-
processed = processed.replace(oldVersionString, newVersionString);
67+
matches.forEach(match => {
68+
// If match includes 'lotus-', replace with 'lotus-NEW_VERSION'
69+
// Otherwise just replace with NEW_VERSION
70+
const replacement = match.includes('lotus-') ?
71+
`lotus-${NEW_VERSION}` :
72+
NEW_VERSION;
73+
74+
processed = processed.replace(match, replacement);
4775
});
48-
76+
4977
if (content !== processed) {
5078
fs.writeFileSync(file, processed);
51-
console.log(`Updated versions in: ${file}`);
79+
console.log(`Updated in ${file}:`);
5280
console.log(`Found patterns: ${matches.join(', ')}`);
53-
console.log(`Updated to: lotus-${NEW_VERSION}`);
81+
console.log(`Updated to versions containing: ${NEW_VERSION}`);
5482
}
5583
}
5684
} catch (error) {

0 commit comments

Comments
 (0)