Expose schema files #207
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: Docker Publish | |
| on: | |
| push: | |
| branches: [ 'master', 'deploy/staging', 'dev/*' ] | |
| tags: [ 'v*.*.*' ] | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: sinytra/mm_wiki | |
| jobs: | |
| build: | |
| name: Build Docker | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| id-token: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v5 | |
| - name: Git describe | |
| id: ghd | |
| uses: proudust/gh-describe@v2 | |
| with: | |
| match: 'v*' | |
| - name: Install cosign | |
| uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0 | |
| with: | |
| cosign-release: 'v2.2.4' | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
| - name: Log into registry ${{ env.REGISTRY }} | |
| uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Docker metadata | |
| id: meta | |
| uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| - name: Build and push Docker image | |
| id: build-and-push | |
| uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | |
| with: | |
| context: . | |
| build-args: | | |
| "MANUAL_VERSIONING=true" | |
| "GIT_VERSION=${{ steps.ghd.outputs.describe }}" | |
| "GIT_HASH_FULL=${{ steps.ghd.outputs.sha }}" | |
| "GIT_HASH_SHORT=${{ steps.ghd.outputs.short-sha }}" | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache | |
| cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:buildcache,mode=max | |
| - name: Sign the published Docker image | |
| env: | |
| TAGS: ${{ steps.meta.outputs.tags }} | |
| DIGEST: ${{ steps.build-and-push.outputs.digest }} | |
| run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} | |
| - name: Build debug image | |
| uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0 | |
| with: | |
| context: . | |
| build-args: | | |
| "MANUAL_VERSIONING=true" | |
| "GIT_VERSION=${{ steps.ghd.outputs.describe }}" | |
| "GIT_HASH_FULL=${{ steps.ghd.outputs.sha }}" | |
| "GIT_HASH_SHORT=${{ steps.ghd.outputs.short-sha }}" | |
| push: false | |
| target: build | |
| tags: sinytra/mm_wiki_debug | |
| outputs: type=docker,dest=${{ runner.temp }}/mm_wiki_debug.tar | |
| - name: Upload to sentry | |
| env: | |
| SENTRY_ORG: ${{ vars.SENTRY_ORG }} | |
| SENTRY_PROJECT: ${{ vars.SENTRY_PROJECT }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| run: | | |
| docker load --input ${{ runner.temp }}/mm_wiki_debug.tar | |
| docker run --rm -e SENTRY_AUTH_TOKEN -e SENTRY_ORG -e SENTRY_PROJECT sinytra/mm_wiki_debug /bin/bash -c " | |
| sentry-cli debug-files upload --include-sources build/bin/wiki_service build/bin/wiki_service.debug | |
| LIBS=\$(ldd build/bin/wiki_service | awk '/=>/ {print \$3}' | grep '^/') | |
| sentry-cli debug-files upload --include-sources \$LIBS | |
| " | |
| deploy: | |
| if: ${{ github.ref_name == 'master' || github.ref_name == 'deploy/staging' }} | |
| name: Deploy to server | |
| runs-on: ubuntu-latest | |
| needs: build | |
| environment: ${{ github.event_name == 'push' && github.ref_name == 'deploy/staging' && 'staging' || 'production' }} | |
| steps: | |
| - name: Trigger deployment | |
| run: | | |
| curl -X 'POST' \ | |
| '${{ secrets.DEPLOY_ENDPOINT }}' \ | |
| -H 'accept: application/json' \ | |
| -H 'Content-Type: application/json' \ | |
| -H 'x-api-key: ${{ secrets.DEPLOY_API_KEY }}' \ | |
| -d '{ "applicationId": "${{ secrets.DEPLOY_APP_ID }}" }' |