-
Notifications
You must be signed in to change notification settings - Fork 5
85 lines (69 loc) · 2.39 KB
/
deploy.prod.js.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
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: 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 }}