-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (96 loc) · 3.33 KB
/
main.yml
File metadata and controls
110 lines (96 loc) · 3.33 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
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: Functionly build and publish
on:
workflow_dispatch:
jobs:
dev:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '8'
- name: Install dependencies
run: npm i --no-save -q
- name: Setup .npmrc for npmjs
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Auto Increment Version, and Publish to npmjs
run: |
git config --global user.email "jaystack-ci@jaystack.com"
git config --global user.name "jaystack-ci"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
npm version patch -m "Auto-increment version: %s" --force
npm publish --tag dev
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Git operations
run: |
git tag -f dev
git push -f --tags
git push
stage:
needs: dev
runs-on: ubuntu-latest
environment: stage
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: 'refs/tags/dev'
- name: Configure npm
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract package version
id: package_version
run: echo "::set-output name=VERSION::$(jq -r .version package.json)"
shell: bash
- name: Configure Git
run: |
git config --global user.email "jaystack-ci@jaystack.com"
git config --global user.name "jaystack-ci"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Create and push git tag
run: |
git tag -f stage
git push -f --tags
- name: Publish to npm
run: npm dist-tag add functionly@${{ steps.package_version.outputs.VERSION }} stage
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
live:
needs: stage
runs-on: ubuntu-latest
environment: live
permissions:
contents: write
steps:
- uses: actions/checkout@v3
with:
ref: 'refs/tags/stage'
- name: Configure npm
run: echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract package version
id: package_version
run: echo "::set-output name=VERSION::$(jq -r .version package.json)"
shell: bash
- name: Configure Git
run: |
git config --global user.email "jaystack-ci@jaystack.com"
git config --global user.name "jaystack-ci"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
- name: Create and push git tag
run: |
git tag -f latest
git push -f --tags
- name: Publish to npm
run: npm dist-tag add functionly@${{ steps.package_version.outputs.VERSION }} latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}