-
Notifications
You must be signed in to change notification settings - Fork 157
58 lines (55 loc) · 1.67 KB
/
deploy-production.yml
File metadata and controls
58 lines (55 loc) · 1.67 KB
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
name: Deploy to production
on:
workflow_dispatch:
inputs:
tag:
description: 'Git tag to deploy'
required: true
workflow_call:
inputs:
tag:
description: 'Git tag to deploy'
required: true
type: 'string'
secrets:
GH_APP_CREDENTIALS_TOKEN:
description: 'GitHub App credentials token'
required: true
env:
NODE_FLAGS: --max_old_space_size=4096
TAG: ${{ inputs.tag }}
jobs:
deploy:
environment:
name: Production
url: https://bemuse.ninja
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up project
uses: ./.github/actions/setup-project
- name: Download release
run: |
gh release download $TAG --pattern dist.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Extract build
run: tar -xvzf dist.tar.gz
- name: Checks
run: node build-scripts pre-deploy
- name: Deploy
run: |
if [ -n "$GH_APP_CREDENTIALS_TOKEN" ]
then
GH_TOKEN="$(npx obtain-github-app-installation-access-token ci $GH_APP_CREDENTIALS_TOKEN)"
echo "::add-mask::$GH_TOKEN"
git remote add www https://akibot:$GH_TOKEN@github.com/bemusic/bemusic.github.io.git
git config --global user.email "aki@spacet.me"
git config --global user.name "Aki running on GitHub Actions"
node build-scripts deploy
else
echo "GH_APP_CREDENTIALS_TOKEN is not set, skipped"
fi
env:
GH_APP_CREDENTIALS_TOKEN: ${{ secrets.GH_APP_CREDENTIALS_TOKEN }}