Skip to content

Deploy to production #1616

Deploy to production

Deploy to production #1616

Workflow file for this run

name: Deploy to production
on:
create:
tags:
- v*
jobs:
deploy_to_heroku:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags, default 1
- name: Use Node.js 20.11.1
uses: actions/setup-node@v4
with:
node-version: '20.11.1'
- name: Get the version
id: app_version
run: echo ::set-output name=APP_VERSION::$(git describe --always --tags)
- run: echo ${{ steps.app_version.outputs.APP_VERSION }}
- name: Install Heroku CLI
run: curl https://cli-assets.heroku.com/install.sh | sh
- name: Deploy to Heroku
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{secrets.HEROKU_APP_NAME_PRODUCTION}}
heroku_email: ${{secrets.HEROKU_EMAIL}}
env:
HD_APP_VERSION: ${{ steps.app_version.outputs.APP_VERSION }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
push_to_docker_hub:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # fetch all tags, default 1
- name: Use Node.js 20.11.1
uses: actions/setup-node@v4
with:
node-version: '20.11.1'
- name: Get the version
id: app_version
run: echo ::set-output name=APP_VERSION::$(git describe --always --tags)
- run: echo ${{ steps.app_version.outputs.APP_VERSION }}
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image and push to Docker Hub
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
build-args: |
NPM_TOKEN=${{ secrets.NPM_TOKEN }}
push: true
tags: |
${{ secrets.DOCKER_HUB_USERNAME }}/arena:latest
${{ secrets.DOCKER_HUB_USERNAME }}/arena:${{ steps.app_version.outputs.APP_VERSION }}