diff --git a/.gitea/workflows/demo.yml b/.gitea/workflows/demo.yml deleted file mode 100644 index 016ba53..0000000 --- a/.gitea/workflows/demo.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Gitea Actions Demo -run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 -on: [push] - -jobs: - Explore-Gitea-Actions: - runs-on: ubuntu-latest - steps: - - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - - name: Check out repository code - uses: actions/checkout@v4 - - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - - run: echo "🖥️ The workflow is now ready to test your code on the runner." - - name: List files in the repository - run: | - ls ${{ gitea.workspace }} - - run: echo "🍏 This job's status is ${{ job.status }}." - \ No newline at end of file diff --git a/.gitea/workflows/publish.yml b/.gitea/workflows/publish.yml index 988e3d5..43f51a8 100644 --- a/.gitea/workflows/publish.yml +++ b/.gitea/workflows/publish.yml @@ -13,21 +13,30 @@ jobs: - name: Check out repository uses: actions/checkout@v4 - - name: Set up Docker Buildx 🚀 - uses: docker/setup-buildx-action@v3 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v35 + with: + since_last_remote_commit: true + separator: "," - - name: Login to Docker Hub 🚢 - uses: docker/login-action@v3 + - name: Copy repository contents + uses: appleboy/scp-action@0.1.7 with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} - - - name: Build and push 🏗️ - uses: docker/build-push-action@v2 + host: ${{ secrets.HOST }} + port: ${{ secrets.PORT }} + username: ${{ secrets.USERNAME }} + key: ${{ secrets.KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + source: ${{ steps.changed-files.outputs.all_changed_files }} + target: ${{ secrets.REMOTE_PATH }} + + - name: Restart remote application + uses: appleboy/ssh-action@1.0.3 with: - context: . - file: ./Dockerfile - push: false - # tags: | - # ${{ secrets.DOCKER_HUB_USERNAME}}/{docker_repository}:${{ github.sha }} - # ${{ secrets.DOCKER_HUB_USERNAME}}/{docker_repository}:latest \ No newline at end of file + host: ${{ inputs.host }} + port: ${{ inputs.port }} + username: ${{ inputs.username }} + key: ${{ secrets.KEY }} + passphrase: ${{ secrets.PASSPHRASE }} + script: cd ${{ secrets.remote-path }} && docker build . && docker run -p 3000:3000