Skip to content

Commit 549386c

Browse files
committed
fix(ci): should install correct PNPM_VERSION from tag
1 parent e655de1 commit 549386c

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

.github/workflows/build_image_pnpm.yml

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,48 +42,55 @@ jobs:
4242
# Use the repository name as the image name for simplicity
4343
IMAGE_NAME="$(echo ${GITHUB_REPOSITORY} | cut -d: -f1 | tr '[:upper:]' '[:lower:]')"
4444
45-
SUFFIX="${TAG}"
46-
4745
# Set output parameters.
4846
echo "imageName=${IMAGE_NAME}" >> $GITHUB_OUTPUT
49-
echo "suffix=${SUFFIX}" >> $GITHUB_OUTPUT
47+
echo "suffix=${TAG}" >> $GITHUB_OUTPUT
48+
echo "pnpmVersion=${TAG:4}" >> $GITHUB_OUTPUT
5049
5150
- name: Build node
52-
uses: docker/build-push-action@v5
51+
uses: docker/build-push-action@v6
5352
with:
5453
file: ./node.Dockerfile
5554
platforms: linux/amd64,linux/arm64
5655
push: true
5756
tags: |
5857
${{ steps.container_detail.outputs.imageName }}:node
5958
${{ steps.container_detail.outputs.imageName }}:node_${{ steps.container_detail.outputs.suffix }}
59+
build-args: |
60+
PNPM_VERSION=${{ steps.container_detail.outputs.pnpmVersion }}
6061
6162
- name: Build node-dev
62-
uses: docker/build-push-action@v5
63+
uses: docker/build-push-action@v6
6364
with:
6465
file: ./node-dev.Dockerfile
6566
platforms: linux/amd64,linux/arm64
6667
push: true
6768
tags: |
6869
${{ steps.container_detail.outputs.imageName }}:node-dev
6970
${{ steps.container_detail.outputs.imageName }}:node-dev_${{ steps.container_detail.outputs.suffix }}
71+
build-args: |
72+
PNPM_VERSION=${{ steps.container_detail.outputs.pnpmVersion }}
7073
7174
- name: Build node-aws
72-
uses: docker/build-push-action@v5
75+
uses: docker/build-push-action@v6
7376
with:
7477
file: ./node-aws.Dockerfile
7578
platforms: linux/amd64,linux/arm64
7679
push: true
7780
tags: |
7881
${{ steps.container_detail.outputs.imageName }}:node-aws
7982
${{ steps.container_detail.outputs.imageName }}:node-aws_${{ steps.container_detail.outputs.suffix }}
83+
build-args: |
84+
PNPM_VERSION=${{ steps.container_detail.outputs.pnpmVersion }}
8085
8186
- name: Build node-aws-dev
82-
uses: docker/build-push-action@v5
87+
uses: docker/build-push-action@v6
8388
with:
8489
file: ./node-aws-dev.Dockerfile
8590
platforms: linux/amd64,linux/arm64
8691
push: true
8792
tags: |
8893
${{ steps.container_detail.outputs.imageName }}:node-aws-dev
8994
${{ steps.container_detail.outputs.imageName }}:node-aws-dev_${{ steps.container_detail.outputs.suffix }}
95+
build-args: |
96+
PNPM_VERSION=${{ steps.container_detail.outputs.pnpmVersion }}

node.Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ARG ALPINE_VERSION=3.21
2+
ARG PNPM_VERSION=latest
23

34
FROM node:lts-alpine${ALPINE_VERSION}
45
LABEL maintainer="[email protected]"
@@ -27,7 +28,7 @@ RUN touch /etc/profile.d/pnpmPath.sh && \
2728
ADD "https://api.github.com/repos/pnpm/pnpm/tags?per_page=1" latest_commit
2829
RUN npm install --global corepack@latest
2930
RUN corepack enable
30-
RUN corepack prepare pnpm --activate
31+
RUN corepack prepare pnpm@$PNPM_VERSION --activate
3132
RUN pnpm i -g @antfu/ni && \
3233
touch ~/.nirc && \
3334
echo 'defaultAgent=pnpm' >> ~/.nirc && \

0 commit comments

Comments
 (0)