release mage server #59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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-lts }} | |
| - 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-lts }} | |
| - name: install json util | |
| run: npm i -g json | |
| - name: download service artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mage.service-artifacts | |
| - name: download web-app artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mage.web-app-artifacts | |
| - 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-lts }} | |
| - name: install json util | |
| run: npm i -g json | |
| - name: download service packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mage.service-artifacts | |
| - name: download web-app packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: mage.web-app-artifacts | |
| - name: publish mage service | |
| run: | | |
| npm config set -- '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }} | |
| npm publish --access public $(ls -1 ngageoint-mage.service-*.tgz) ${{(inputs.is_prerelease && '--tag beta') || ''}} || echo "skipping mage service publish..." | |
| - name: publish mage web | |
| run: | | |
| npm config set -- '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }} | |
| npm publish --access public $(ls -1 ngageoint-mage.web-app-*.tgz) ${{(inputs.is_prerelease && '--tag beta') || ''}} || echo "skipping mage web app publish..." | |
| - name: publish mage core | |
| run: | | |
| npm config set -- '//registry.npmjs.org/:_authToken' ${{ secrets.NPM_TOKEN }} | |
| npm publish --access public $(ls -1 ngageoint-mage.web-core-lib-*.tgz) ${{(inputs.is_prerelease && '--tag beta') || ''}} || echo "skipping mage core publish..." |