With relative folder? #13
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: deploy | |
| on: | |
| push: | |
| branches: | |
| - 'laravel-beta' | |
| jobs: | |
| deploy_beta: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Convert repository name to lower case | |
| run: | | |
| echo REPOSITORY_LC=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v1 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Composer install | |
| run: | | |
| cd ./jccp | |
| composer install | |
| - name: Build and push | |
| uses: docker/build-push-action@v2 | |
| with: | |
| push: true | |
| tags: ghcr.io/${{ env.REPOSITORY_LC }}:beta | |
| file: ./jccp/Dockerfile | |
| build-args: | | |
| SHORT_SHA:${{ github.sha }} | |
| - name: Login to production server and deploy | |
| uses: fifsky/[email protected] | |
| with: | |
| command: | | |
| docker stop $(docker ps -aq --filter "name=beta") | |
| docker rm $(docker ps -aq --filter "name=beta") | |
| docker image rm ghcr.io/${{ env.REPOSITORY_LC }}:beta | |
| export CR_GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
| echo $CR_GITHUB_TOKEN | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
| docker pull ghcr.io/${{ env.REPOSITORY_LC }}:beta | |
| docker run --name beta --env SHORT_SHA=$( echo ${{ github.sha }} | cut -c 1-7 ) -d -p 8002:80 --restart unless-stopped ghcr.io/${{ env.REPOSITORY_LC }}:beta | |
| host: ${{ secrets.HOST }} | |
| user: ${{ secrets.USER }} | |
| key: ${{ secrets.PRIVATE_KEY }} | |