docs: redirect lost users #368
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: Build and Push | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| tag_custom: | |
| # The tag "pprd" triggers deploy to pprd.designsafe-ci.org. | |
| description: 'Custom docker image tag e.g. "pprd"' | |
| required: false | |
| type: string | |
| push: | |
| branches: | |
| - main | |
| - pprd | |
| - epic/v3 | |
| - epic/v3--* | |
| - any/branch-you-want | |
| jobs: | |
| docker: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Checkout repo | |
| uses: actions/checkout@v3 | |
| - name: Get shortsha and branch name | |
| id: vars | |
| run: | | |
| if [ -z "$EVENT_SHA" ]; then SHORT_SHA=${GITHUB_SHA::8}; else SHORT_SHA=${EVENT_SHA::8}; fi | |
| echo ::set-output name=sha_short::${SHORT_SHA} | |
| SHORT_REF=`git symbolic-ref --short HEAD | sed 's/[^[:alnum:]\.\_\-]/-/g'` | |
| echo ::set-output name=ref_short::${SHORT_REF} | |
| env: | |
| EVENT_SHA: ${{ github.event.client_payload.sha }} | |
| - name: Determine environment tag | |
| id: env_tag | |
| run: | | |
| if [ -n "${{ inputs.tag_custom }}" ]; then | |
| ENV_TAG="${{ inputs.tag_custom }}" | |
| elif [ "${{ github.ref_name }}" = "main" ]; then | |
| ENV_TAG="latest" | |
| elif [ "${{ github.ref_name }}" = "pprd" ]; then | |
| ENV_TAG="pprd" | |
| else | |
| ENV_TAG="${{ steps.vars.outputs.ref_short }}" | |
| fi | |
| echo ::set-output name=env_tag::${ENV_TAG} | |
| - name: Print vars | |
| run: | | |
| echo "Short SHA: $SHORT_SHA" | |
| echo "Short Ref: $SHORT_REF" | |
| echo "Environment Tag: $ENV_TAG" | |
| env: | |
| SHORT_SHA: ${{ steps.vars.outputs.sha_short }} | |
| SHORT_REF: ${{ steps.vars.outputs.ref_short }} | |
| ENV_TAG: ${{ steps.env_tag.outputs.env_tag }} | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v3 | |
| with: | |
| push: true | |
| tags: designsafeci/ds-user-guide:${{ steps.env_tag.outputs.env_tag }},designsafeci/ds-user-guide:${{ steps.vars.outputs.sha_short }},designsafeci/ds-user-guide:${{ steps.vars.outputs.ref_short }} | |
| - name: Post build status in slack | |
| id: slack | |
| uses: slackapi/slack-github-action@v1.23.0 | |
| with: | |
| # This data can be any valid JSON from a previous step in the GitHub Action | |
| payload: | | |
| { | |
| "build_status": "${{ job.status }}" | |
| } | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |