Skip to content

Commit

Permalink
[feat]build and push
Browse files Browse the repository at this point in the history
  • Loading branch information
piupuer committed Dec 19, 2023
1 parent c03ec48 commit 2680ae6
Showing 1 changed file with 15 additions and 25 deletions.
40 changes: 15 additions & 25 deletions .github/workflows/dev.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PC React CI
name: Build

on:
push:
Expand All @@ -8,30 +8,20 @@ on:

jobs:

build:

build_and_push:
name: Build and Push Docker image
runs-on: ubuntu-latest

permissions:
packages: write
contents: read
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Build image
id: build
run: |
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} ${{ secrets.DOCKER_REGISTRY }}
export BUILD_TAG=${{ secrets.DOCKER_REGISTRY }}/cinch/pc-react:$(date +%s)
echo "tag=$BUILD_TAG" >> $GITHUB_OUTPUT
docker build . -f Dockerfile --tag $BUILD_TAG
docker push $BUILD_TAG
- name: Check out the repo
uses: actions/checkout@v4

- name: Run container
uses: appleboy/[email protected]
with:
host: ${{ secrets.SEVER_HOST }}
username: ${{ secrets.SEVER_USERNAME }}
password: ${{ secrets.SEVER_PASSWORD }}
port: ${{ secrets.SEVER_PORT }}
script: |
export PC_REACT_TAG=${{ steps.build.outputs.tag }}
${{ secrets.RUN_SCRIPT }}
- name: Build and publish a Docker image for ${{ github.repository }}
uses: macbre/push-to-ghcr@master
with:
image_name: ${{ github.repository }} # it will be lowercased internally
github_token: ${{ secrets.GITHUB_TOKEN }}
dockerfile: ./Dockerfile
image_tag: latest

0 comments on commit 2680ae6

Please sign in to comment.