Skip to content
This repository was archived by the owner on Nov 6, 2024. It is now read-only.

Commit e6ddcde

Browse files
2328760190nekohy
authored andcommitted
Create docker-image.yml
1 parent 051f14f commit e6ddcde

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/docker-image.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Docker Image CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Extract version from package.json
13+
id: extract_version # 设置 ID 以便后续步骤引用
14+
run: |
15+
VERSION=$(jq -r '.version' package.json)
16+
echo "version=$VERSION" >> $GITHUB_OUTPUT
17+
- name: Build the Docker image
18+
run: docker build . --file Dockerfile --tag chb2024/pieces-os:${{ steps.extract_version.outputs.version }} --tag chb2024/pieces-os:latest
19+
- name: Log in to Docker Hub
20+
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin
21+
- name: Push the Docker image with version tag
22+
run: docker push chb2024/pieces-os:${{ steps.extract_version.outputs.version }}
23+
- name: Push the Docker image with latest tag
24+
run: docker push chb2024/pieces-os:latest

0 commit comments

Comments
 (0)