-
-
Notifications
You must be signed in to change notification settings - Fork 4
71 lines (59 loc) · 1.98 KB
/
auto-deploy.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
name: Create new release and deploy onto github pages
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
type: string
branch:
description: 'Branch'
required: true
type: string
default: 'master'
jobs:
deploy:
name: Deploy new version
runs-on: ubuntu-latest
env:
CI: ''
#GITHUB_TOKEN: ${{ secrets.APP_TOKEN }}
#GH_TOKEN: ${{ secrets.APP_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
- name: checkout
uses: actions/checkout@v3
- name: setup node.js
uses: actions/setup-node@v4
with:
node-version: 'latest'
cache: 'npm'
- name: install dependencies
run: npm ci
- name: git config
run: |
git config --global user.email "[email protected]"
git config --global user.name "github-actions-bot"
git remote set-url origin https://git:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
- name: create version
run: |
git checkout -b release-${{ inputs.version }}
npm version ${{ inputs.version }} --allow-same-version
git push origin release-${{ inputs.version }}
git tag -d $(git tag -l)
- name: create PR
run: gh pr create --title "Release ${{ inputs.version }}" -B ${{ inputs.branch }} -H release-${{ inputs.version }} --fill
- name: merge PR
run: gh pr merge release-${{ inputs.version }} --delete-branch --merge
- name: create release
run: gh release create ${{ inputs.version }} --generate-notes
- name: deploy with gh-pages
run: npm run deploy