Skip to content

Commit

Permalink
🔧 update docker-image.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
XiYang6666 committed May 13, 2024
1 parent 4a2e2ba commit f44acaa
Showing 1 changed file with 29 additions and 19 deletions.
48 changes: 29 additions & 19 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,39 @@ name: Docker Image CI

on:
push:
branches: [ "master" ]
branches: ["master"]
pull_request:
branches: [ "master" ]
branches: ["master"]

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20.x
- name: Setup pnpm
uses: pnpm/action-setup@v3.0.0
- run: pnpm install
- run: pnpm build
- name: docker login
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u xiyang6666 --password-stdin
- name: Build the Docker image
run: docker build . --file Dockerfile --tag xiyang6666/mainpage:$(git rev-parse --abbrev-ref HEAD)-${{ github.run_number }}
- name: Push the Docker image
run: docker push xiyang6666/mainpage:$(git rev-parse --abbrev-ref HEAD)-${{ github.run_number }}
- uses: actions/checkout@v4

- run: git fetch --unshallow

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Setup pnpm
uses: pnpm/action-setup@v3.0.0

- run: pnpm install

- run: pnpm build

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: xiyang6666
password: ${{ secrets.DOCKER_TOKEN }}

- name: Build the Docker image
run: docker build . --file Dockerfile --tag xiyang6666/mainpage:$(git rev-parse --abbrev-ref HEAD)-$(git rev-list --count HEAD)

- name: Push the Docker image
run: docker push xiyang6666/mainpage:$(git rev-parse --abbrev-ref HEAD)-$(git rev-list --count HEAD)

0 comments on commit f44acaa

Please sign in to comment.