ci: dockerized #163
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: Main workflow | |
| on: | |
| push: | |
| branches: | |
| - main | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| permissions: | |
| contents: read | |
| packages: write | |
| concurrency: | |
| group: build-and-push-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build-and-push-image: | |
| name: Build and publish a Docker image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Set up QEMU and Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Log in to the Container registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max | |
| build-args: | | |
| BASE_URL=${{ vars.BASE_URL }} | |
| deploy-service: | |
| name: Deploy application as service | |
| needs: build-and-push-image | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy via Webhook | |
| env: | |
| WEBHOOK_URL: ${{ vars._WEBHOOK_URL_PART_UP }} | |
| WEBHOOK_SECRET: ${{ secrets._WEBHOOK_SECRET_PART_UP }} | |
| WEBHOOK_DEPLOY_PATH: ${{ vars._WEBHOOK_DEPLOY_PATH }} | |
| run: | | |
| curl --silent --show-error --fail -X POST \ | |
| -H "X-Nymph-Stack-Secret: $WEBHOOK_SECRET" \ | |
| -H "Content-Type: application/json" \ | |
| -d "{\"path\": \"$WEBHOOK_DEPLOY_PATH\"}" \ | |
| "$WEBHOOK_URL" |