forked from ngageoint/mage-server
-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (133 loc) · 5.35 KB
/
release.yaml
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: release mage server
on:
workflow_dispatch:
inputs:
version:
description: The version you want to assign to the release
type: string
required: true
is_draft:
description: Whether to mark this a draft release
type: boolean
required: false
default: false
is_prerelease:
description: Whether this is a prerelease
type: boolean
required: false
default: true
# TODO: possibly use release branches to perform the release process
# push:
# branches:
# - release/*
# - prerelease/*
# TODO: possibly use release event to perform the release process
# release:
jobs:
config:
uses: ./.github/workflows/config.yaml
check_release_version:
needs: [ config ]
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup node
uses: actions/setup-node@v3
with:
node-version: ${{ needs.config.outputs.node_versions-latest }}
- name: install json util
run: npm i -g json
- name: check project
run: |
[[ $(json version < ./package.json) = ${{ inputs.version }} ]] || exit 1
- name: check service
run: |
[[ $(json version < ./service/package.json) = ${{ inputs.version }} ]] || exit 1
- name: check web-app
run: |
[[ $(json version < ./web-app/package.json) = ${{ inputs.version }} ]] || exit 1
- name: check web-core-lib
run: |
[[ $(json version < ./web-app/projects/core-lib/package.json) = ${{ inputs.version }} ]] || exit 1
build_and_test-service:
needs: [ check_release_version ]
uses: ./.github/workflows/build_test.service.yaml
build_and_test-web-app:
needs: [ check_release_version ]
uses: ./.github/workflows/build_test.web-app.yaml
create_release:
name: create release
needs: [ config, build_and_test-service, build_and_test-web-app ]
runs-on: ubuntu-latest
steps:
- name: setup node
uses: actions/setup-node@v3
with:
node-version: ${{ needs.config.outputs.node_versions-latest }}
- name: install json util
run: npm i -g json
- name: download service packages
uses: actions/download-artifact@v3
with:
name: mage_service_packages
- name: download web-app packages
uses: actions/download-artifact@v3
with:
name: mage_web-app_packages
- name: generate instance package.json
run: |
(
printf '{ "name": "mage.instance", "version": "%s" }\n' ${{ inputs.version }} &&
printf '{ "scripts": { "start": "mage.service --plugin @ngageoint/mage.nga-msi --plugin @ngageoint/mage.image.service" }}\n' &&
printf '{ "dependencies": { "@ngageoint/mage.service": "./%s" }}\n' $(ls -1 *mage.service*.tgz) &&
printf '{ "dependencies": { "@ngageoint/mage.web-app": "./%s" }}\n' $(ls -1 *mage.web-app*.tgz) &&
printf '{ "dependencies": { "@ngageoint/mage.nga-msi": "./%s" }}\n' $(ls -1 *mage.nga-msi*.tgz) &&
printf '{ "dependencies": { "@ngageoint/mage.image.service": "./%s" }}\n' $(ls -l *mage.image.service*.tgz)
) | json --deep-merge > package.json
echo "instance package.json"
cat package.json
- name: create release
uses: softprops/action-gh-release@v1
with:
name: ${{ inputs.version }}
prerelease: ${{ inputs.is_prerelease }}
draft: ${{ inputs.is_draft }}
tag_name: ${{ inputs.version }}
target_commitish: ${{ github.sha }}
files: |
package.json
ngageoint-mage.*.tgz
publish_packages:
name: publish packages
needs: [ config, create_release ]
runs-on: ubuntu-latest
steps:
- name: setup node
uses: actions/setup-node@v3
with:
node-version: ${{ needs.config.outputs.node_versions-latest }}
- name: install json util
run: npm i -g json
- name: download service packages
uses: actions/download-artifact@v3
with:
name: mage_service_packages
- name: download web-app packages
uses: actions/download-artifact@v3
with:
name: mage_web-app_packages
- name: publish to package registry
env:
NPM_CONFIG_USERCONFIG: "${{ runner.temp }}/gitlab.npmrc"
run: |
npm config set -- '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }}
npm publish --access public $(ls -1 ngageoint-mage.service-*.tgz)
npm publish --access public $(ls -1 ngageoint-mage.web-core-lib-*.tgz)
npm publish --access public $(ls -1 ngageoint-mage.web-app-*.tgz)
check_version=$(tar xzOf ngageoint-mage.image.service-*.tgz package/package.json | json version)
echo "checking @ngageoint/mage.image.service@${check_version}"
[[ -n $(npm view @ngageoint/mage.image.service@${check_version} version) ]] || npm publish --access public $(ls -1 ngageoint-mage.image.service-*.tgz)
check_version=$(tar xzOf ngageoint-mage.nga-msi-*.tgz package/package.json | json version)
echo "checking @ngageoint/mage.nga-msi@${check_version}"
[[ -n $(npm view @ngageoint/mage.nga-msi@${check_version} version) ]] || npm publish --access public $(ls -1 ngageoint-mage.nga-msi-*.tgz)