Deploy #34
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: | |
| workflow_call: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Version Tag" | |
| required: false | |
| #workflow_run: | |
| # workflows: ["Build"] | |
| # types: [completed] | |
| env: | |
| traefik-host: badges.cssnr.com | |
| stack-file: docker-compose-swarm.yaml | |
| stack-name: ${{ github.repository_owner }}-${{ github.event.repository.name }} | |
| version: ${{ inputs.version || github.event.workflow_run.head_branch || github.ref_name }} | |
| jobs: | |
| deploy: | |
| #if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} | |
| name: "Deploy" | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| environment: | |
| name: swarm | |
| url: https://badges.cssnr.com/ | |
| steps: | |
| - name: "Debug CTX github" | |
| if: ${{ !github.event.act }} | |
| continue-on-error: true | |
| env: | |
| GITHUB_CTX: ${{ toJSON(github) }} | |
| run: echo "$GITHUB_CTX" | |
| - name: "Debug 1" | |
| continue-on-error: true | |
| run: | | |
| echo "inputs.version: ${{ inputs.version }}" | |
| echo "github.event.workflow_run.head_branch: ${{ github.event.workflow_run.head_branch }}" | |
| echo "github.ref_name: ${{ github.ref_name }}" | |
| echo "env.version: ${{ env.version }}" | |
| - name: "Portainer Deploy" | |
| uses: cssnr/portainer-stack-deploy-action@v1 | |
| env: | |
| version: ${{ env.version == 'master' && 'latest' || env.version }} | |
| with: | |
| url: ${{ secrets.PORTAINER_URL }} | |
| token: ${{ secrets.PORTAINER_TOKEN }} | |
| file: ${{ env.stack-file }} | |
| name: ${{ env.stack-name }} | |
| username: ${{ vars.GHCR_USER }} | |
| password: ${{ secrets.GHCR_PASS }} | |
| env_json: | | |
| { | |
| "VERSION": "${{ env.version }}", | |
| "STACK_NAME": "${{ env.stack-name }}", | |
| "TRAEFIK_HOST": "${{ env.traefik-host }}", | |
| "GITHUB_TOKEN": "${{ secrets.GH_PAT }}", | |
| "VT_API_KEY": "${{ secrets.VT_API_KEY }}", | |
| "SENTRY_URL": "${{ secrets.SENTRY_URL }}", | |
| "SENTRY_ENVIRONMENT": "prod", | |
| "INFLUX_URL": "${{ secrets.INFLUX_URL }}", | |
| "INFLUX_TOKEN": "${{ secrets.INFLUX_TOKEN }}", | |
| "INFLUX_ORG": "${{ vars.INFLUX_ORG }}", | |
| "INFLUX_BUCKET": "${{ vars.INFLUX_BUCKET }}" | |
| } | |
| #- name: "Debug 2" | |
| # continue-on-error: true | |
| # env: | |
| # version: ${{ env.version == 'master' && 'latest' || env.version }} | |
| # run: | | |
| # echo "env.version: ${{ env.version }}" | |
| # echo "ghcr.io/${{ github.repository }}:${{ env.version }}" | |
| # | |
| ## https://render.com/docs/deploy-hooks#deploying-from-an-image-registry | |
| #- name: "Render Deploy" | |
| # continue-on-error: true | |
| # uses: cssnr/web-request-action@v1 | |
| # env: | |
| # version: ${{ env.version == 'master' && 'latest' || env.version }} | |
| # with: | |
| # url: ${{ secrets.RENDER_HOOK }} | |
| # params: '{"imgURL": "ghcr.io/${{ github.repository }}:${{ env.version }}"}' |