forked from cytoscape/cytoscape.js
-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (104 loc) · 3.95 KB
/
patch-release.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
name: Patch Release
on:
workflow_dispatch:
jobs:
patch-release:
runs-on: ubuntu-latest
environment: prod
steps:
- name: Extract branch name
shell: bash
id: extract_branch
run: |
echo "BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
echo "Branch: " $BRANCH
- name: checkout patch branch
uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH }}
- uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Get new version string
id: get_new_patch_version
run: |
chmod +rx ./.github/workflows/scripts/new-patch-version.sh
. ./.github/workflows/scripts/new-patch-version.sh
shell: bash
- name: See patch branch
run: echo branch ${{ env.BRANCH }}
shell: bash
- name: See new patch version
run: echo "# version:" ${{ env.VERSION }}
shell: bash
- name: checkout master branch
uses: actions/checkout@v3
with:
ref: master
fetch-depth: 0
- name: Set Git Config
run : |
# Set git configs
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Update Version on master
id: update_backport_version_master
run: |
jq --arg ver "${{ env.VERSION }}" '.versions += [$ver]' ./documentation/versions.json >> /tmp/temp.json
mv /tmp/temp.json ./documentation/versions.json
git add . && git commit -m "Docs: Add ${{ env.VERSION }} to versions.json"
git push
- name: checkout unstable branch
uses: actions/checkout@v3
with:
ref: unstable
fetch-depth: 0
- name: Update Version on unstable
id: update_backport_version_unstable
run: |
jq --arg ver "${{ env.VERSION }}" '.versions += [$ver]' ./documentation/versions.json >> /tmp/temp.json
mv /tmp/temp.json ./documentation/versions.json
git add . && git commit -m "Docs: Add ${{ env.VERSION }} to versions.json"
git push
git checkout ${{ env.BRANCH }}
- name: Install dependencies
run: npm install
- name: Run tests
run : |
npm test
- name: Set Git Config
run : |
# Set git configs
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
- name: Pre Release Tests
id: release
run: |
chmod +rx .github/workflows/scripts/pre_release_test.sh
. .github/workflows/scripts/pre_release_test.sh ${{ env.BRANCH }}
- name: Archive action failure results
uses: actions/upload-artifact@v3
if: ${{ failure() && steps.release.conclusion == 'failure' }}
with:
name: npm-release--failure-report
path: /home/runner/.npm/_logs/
- name: Publish Package To npmjs
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Publish Package to GitHub Releases
run: |
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.MAIN_GH_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/${{ github.repository }}/releases \
-d '{"tag_name":"v${{ env.VERSION }}","target_commitish":"master","name":"v${{ env.VERSION }}","body":"Release version v${{ env.VERSION }}","draft":false,"prerelease":false,"generate_release_notes":false}'
- name: Deploy to Github Pages 🚀
if: ${{ env.BRANCH == 'master' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: documentation