Improve deepl token type check #89
This file contains 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: Publish | |
on: | |
push: | |
branches: [master] | |
tags: | |
- v1.* | |
- v2.* | |
- v3.* | |
- v4.* | |
- v5.* | |
jobs: | |
test: | |
uses: ./.github/workflows/reusable-test.yml | |
secrets: inherit | |
publish-cloud: | |
runs-on: ubuntu-22.04 | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set RELEASE_VERSION env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Build the Docker image for cloud | |
run: docker build . --file Dockerfile --target production --build-arg COMMIT_HASH=$GITHUB_SHA --build-arg PROPRIETARY_MODE=${{ secrets.PROPRIETARY_MODE }} --build-arg STRIPE_PUBLIC_API_KEY=${{ secrets.STRIPE_PUBLIC_API_KEY }} --build-arg TEXTERIFY_PAYMENT_SERVER=${{ secrets.TEXTERIFY_PAYMENT_SERVER }} --build-arg SENTRY_DSN_FRONTEND=${{ secrets.SENTRY_DSN_FRONTEND }} --tag chrztoph/texterify-cloud:$GITHUB_SHA | |
# Push to DigitalOcean registry | |
- name: Install doctl | |
uses: digitalocean/action-doctl@v2 | |
with: | |
token: ${{ secrets.DIGITALOCEAN_TOKEN }} | |
- name: Log in to DigitalOcean Container Registry with short-lived credentials | |
run: doctl registry login --expiry-seconds 1200 | |
- name: Tag DigitalOcean image | |
if: env.RELEASE_VERSION | |
run: docker tag chrztoph/texterify-cloud:$GITHUB_SHA registry.digitalocean.com/voidly/txty-cloud:$GITHUB_SHA | |
- name: Tag DigitalOcean image if env.RELEASE_VERSION is set | |
if: env.RELEASE_VERSION | |
run: docker tag chrztoph/texterify-cloud:$GITHUB_SHA registry.digitalocean.com/voidly/txty-cloud:${{ env.RELEASE_VERSION }} | |
- name: Push DigitalOcean GITHUB_SHA image to private registry | |
run: | | |
docker push registry.digitalocean.com/voidly/txty-cloud:$GITHUB_SHA | |
- name: Push DigitalOcean env.RELEASE_VERSION image to private registry | |
if: env.RELEASE_VERSION | |
run: | | |
docker push registry.digitalocean.com/voidly/txty-cloud:${{ env.RELEASE_VERSION }} | |
- name: Start garbage collection | |
run: yes | doctl registry garbage-collection start --force | |
# Slack error message | |
- name: Send notification to Slack if job fails | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,workflow,job,took | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: failure() | |
publish-on-premise: | |
runs-on: ubuntu-22.04 | |
needs: [test] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set RELEASE_VERSION env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build the Docker image for on-premise | |
run: docker build . --file Dockerfile --target production --build-arg COMMIT_HASH=$GITHUB_SHA --tag chrztoph/texterify:$GITHUB_SHA | |
- name: Tag image also as latest | |
run: docker tag chrztoph/texterify:$GITHUB_SHA chrztoph/texterify:latest | |
- name: Push images | |
run: | | |
docker push chrztoph/texterify:$GITHUB_SHA | |
docker push chrztoph/texterify:latest | |
- name: Tag image if tag is set | |
if: env.RELEASE_VERSION | |
run: docker tag chrztoph/texterify:$GITHUB_SHA chrztoph/texterify:${{ env.RELEASE_VERSION }} | |
- name: Push images if tag is set | |
if: env.RELEASE_VERSION | |
run: | | |
docker push chrztoph/texterify:${{ env.RELEASE_VERSION }} | |
- name: Send notification to Slack if job fails | |
uses: 8398a7/action-slack@v3 | |
with: | |
status: ${{ job.status }} | |
fields: repo,message,workflow,job,took | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
if: failure() |