Skip to content

Merge branch 'main' of https://github.com/wu529778790/wallpaper.shenz… #13

Merge branch 'main' of https://github.com/wu529778790/wallpaper.shenz…

Merge branch 'main' of https://github.com/wu529778790/wallpaper.shenz… #13

name: Deploy to Docker
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "19"
- name: Install Pnpm
run: npm install -g pnpm
- name: Install dependencies
run: pnpm install
- name: Build project
run: pnpm run build
- name: Update version and commit
id: version
run: |
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
NEW_VERSION=$(npm version patch)
echo "new-version=${NEW_VERSION}" >> $GITHUB_ENV
git commit -m "chore(release): $NEW_VERSION [skip ci]"
if: ${{ always() }}
- name: Set Docker Buildx
uses: docker/setup-buildx-action@v1
if: ${{ always() }}
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
if: ${{ always() }}
- name: Build and push docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: |
wu529778790/wallpaper.shenzjd.com:${{ env.new-version }}
wu529778790/wallpaper.shenzjd.com:latest
if: ${{ always() }}
- name: Push Git changes
run: |
git push --force
if: ${{ always() }}