Merge pull request #130 from samuelzedec/develop #36
Workflow file for this run
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: CD Pipeline | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Get version | |
| id: image | |
| run: | | |
| VERSION=$(grep '<Version>' Directory.Build.props | sed 's/.*<Version>\(.*\)<\/Version>.*/\1/') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| - name: Login to GHCR | |
| uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GHCR }} | |
| - name: Build and push to GHCR | |
| uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 | |
| with: | |
| context: . | |
| push: true | |
| platforms: linux/amd64 | |
| tags: | | |
| ghcr.io/${{ github.repository_owner }}/riber:latest | |
| ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }} | |
| # | |
| # - name: Deploy to AWS EC2 | |
| # uses: appleboy/ssh-action@v1.0.3 | |
| # with: | |
| # host: ${{ secrets.EC2_HOST }} | |
| # username: ${{ secrets.EC2_USERNAME }} | |
| # key: ${{ secrets.EC2_KEY }} | |
| # script: | | |
| # echo "${{ secrets.GHCR }}" | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin | |
| # docker pull ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }} | |
| # | |
| # docker stop riber-api || true | |
| # docker rm riber-api || true | |
| # | |
| # docker run -d --name riber-api -p 80:8080 --restart unless-stopped \ | |
| # -e ConnectionStrings__DefaultConnection="${{ secrets.CONNECTION_STRING }}" \ | |
| # -e AccessTokenSettings__SecretKey="${{ secrets.ACCESS_TOKEN_SECRET_KEY }}" \ | |
| # -e RefreshTokenSettings__SecretKey="${{ secrets.REFRESH_TOKEN_SECRET_KEY }}" \ | |
| # -e AWS__S3__BucketImagesName="${{ secrets.S3_BUCKET_IMAGES_NAME }}" \ | |
| # ghcr.io/${{ github.repository_owner }}/riber:${{ steps.image.outputs.version }} | |
| # | |
| # docker images | grep riber | tail -n +4 | awk '{print $3}' | xargs -r docker rmi || true |