diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 508c4bc..c6e5f99 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -1,4 +1,4 @@ -name: PC React CI +name: Build on: push: @@ -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/ssh-action@v0.1.7 - 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 \ No newline at end of file