|
5 | 5 | push: |
6 | 6 | branches: |
7 | 7 | - master |
8 | | - |
| 8 | +env: |
| 9 | + IMAGE_NAME: ghcr.io/lemoncode/code-paster:prod-${{github.sha}}-${{github.run_attempt}} |
| 10 | + |
9 | 11 | jobs: |
10 | | - dev-cd: |
11 | | - uses: lemoncode/actions/.github/workflows/aws-ebs.yml@main |
12 | | - with: |
13 | | - files-to-zip: "back/** back/.babelrc front/** front/.babelrc Dockerfile .dockerignore" |
14 | | - dockerArgs: "BASE_API_URL=https://codepaster.net \ |
15 | | - BASE_SOCKET_URL=https://codepaster.net" |
16 | | - secrets: |
17 | | - AWS_EB_APP_NAME: ${{secrets.AWS_EB_APP_NAME}} |
18 | | - AWS_EB_ENV_NAME: ${{secrets.AWS_EB_ENV_NAME}} |
19 | | - AWS_DEPLOY_ACCESS_KEY_ID: ${{secrets.AWS_DEPLOY_ACCESS_KEY_ID}} |
20 | | - AWS_DEPLOY_SECRET_ACCESS_KEY: ${{secrets.AWS_DEPLOY_SECRET_ACCESS_KEY}} |
21 | | - AWS_REGION: ${{secrets.AWS_REGION}} |
22 | | - AWS_DEPLOY_S3_BUCKET: ${{secrets.AWS_DEPLOY_S3_BUCKET}} |
| 12 | + deploy: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + environment: |
| 15 | + name: "Production" |
| 16 | + url: https://codepaster.net/ |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v4 |
| 20 | + |
| 21 | + - name: Log in to GitHub container registry |
| 22 | + uses: docker/login-action@v3 |
| 23 | + with: |
| 24 | + registry: ghcr.io |
| 25 | + username: ${{ github.actor }} |
| 26 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 27 | + |
| 28 | + - name: Build and push docker image |
| 29 | + run: | |
| 30 | + docker build \ |
| 31 | + --build-arg BASE_API_URL=https://codepaster.net \ |
| 32 | + --build-arg BASE_SOCKET_URL=https://codepaster.net \ |
| 33 | + -t ${{env.IMAGE_NAME}} . |
| 34 | + docker push ${{env.IMAGE_NAME}} |
| 35 | +
|
| 36 | + - name: Deploy to Azure |
| 37 | + uses: azure/webapps-deploy@v3 |
| 38 | + with: |
| 39 | + app-name: ${{ secrets.PROD_AZURE_APP_NAME }} |
| 40 | + publish-profile: ${{ secrets.PROD_AZURE_PUBLISH_PROFILE }} |
| 41 | + images: ${{env.IMAGE_NAME}} |
0 commit comments