diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9215c651..f6cbf53b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -14,3 +14,4 @@ updates: directory: / schedule: interval: weekly + #target-branch: nam20485 diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 485bf930..3d9bf482 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -92,49 +92,9 @@ jobs: # create a release - name: "Create GitHub Release" uses: "actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea" # v7.0.1 + id: create-github-release with: github-token: "${{ secrets.GITHUB_TOKEN }}" script: | - try { - const createResponse = await github.rest.repos.createRelease({ - generate_release_notes: true, - name: process.env.RELEASE_NAME, - owner: context.repo.owner, - repo: context.repo.repo, - tag_name: process.env.RELEASE_TAG, - body: require('fs').readFileSync('${{ github.workspace }}/release/release-body.md', 'utf8'), - target_commitish: '${{ github.event.client_payload.ref_name }}' - }); - - const files = - [ - { name: 'OdbDesign-Linux-x64.zip', contentType: 'application/zip' }, - { name: 'OdbDesign-Linux-x64.zip.sha256sum', contentType: 'text/plain' }, - { name: 'OdbDesign-Linux-x64.zip.asc', contentType: 'text/plain' }, - { name: 'OdbDesign-Windows-x64.zip', contentType: 'application/zip' }, - { name: 'OdbDesign-Windows-x64.zip.sha256sum', contentType: 'text/plain' }, - { name: 'OdbDesign-Windows-x64.zip.asc', contentType: 'text/plain' }, - { name: 'OdbDesign-MacOS-x64.zip', contentType: 'application/zip' }, - { name: 'OdbDesign-MacOS-x64.zip.sha256sum', contentType: 'text/plain' }, - { name: 'OdbDesign-MacOS-x64.zip.asc', contentType: 'text/plain' } - ]; - - const artifactsPath = '${{ github.workspace }}/artifacts'; - - for (const file of files) { - const filePath = artifactsPath +'/' + file.name; - const uploadResponse = await github.rest.repos.uploadReleaseAsset({ - owner: context.repo.owner, - repo: context.repo.repo, - release_id: createResponse.data.id, - name: file.name, - data: require('fs').readFileSync(filePath), - headers: { - 'content-type': file.contentType, - 'content-length': require('fs').statSync(filePath).size - } - }); - } - } catch (error) { - core.setFailed(error.message); - } + const script = require('./scripts/create-release.js') + script({github, context, core}, '${{ github.workspace }}', '${{ github.ref_name }}') diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 3bf94bfb..98405baa 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -147,9 +147,9 @@ jobs: with: repository: ${{ github.repository }} event-type: trigger_deploy_release_event - client-payload: > - '{ - "ref_name": "${{ github.ref_name }}", - "run_number": "${{ github.run_number }}", - "dispatch_id": "${{ secrets.DISPATCH_ID }}" + client-payload: | + '{ \ + "ref_name": "${{ github.ref_name }}", \ + "run_number": "${{ github.run_number }}", \ + "dispatch_id": "${{ secrets.DISPATCH_ID }}" \ }' diff --git a/deploy/kube/OdbDesignServer/ingress.yaml b/deploy/kube/local-ingress.yaml similarity index 65% rename from deploy/kube/OdbDesignServer/ingress.yaml rename to deploy/kube/local-ingress.yaml index 574f0982..fa1b4d14 100644 --- a/deploy/kube/OdbDesignServer/ingress.yaml +++ b/deploy/kube/local-ingress.yaml @@ -17,20 +17,17 @@ spec: - host: precision5820 http: paths: - - pathType: Prefix - path: "/" + - path: "/" + pathType: Prefix backend: service: name: odbdesign-server-service port: name: ods-svc-port - # - host: nginx.local - # http: - # paths: - # - path: / - # pathType: Prefix - # backend: - # service: - # name: nginx - # port: - # number: 80 + - path: /swagger + pathType: Prefix + backend: + service: + name: odbdesign-server-swaggerui-service + port: + name: oss-svc-port diff --git a/scripts/create-release.js b/scripts/create-release.js index 4d54bf94..c275fec7 100644 --- a/scripts/create-release.js +++ b/scripts/create-release.js @@ -1,43 +1,51 @@ -try { - const createResponse = await github.rest.repos.createRelease({ - generate_release_notes: true, - name: process.env.RELEASE_NAME, - owner: context.repo.owner, - repo: context.repo.repo, - tag_name: process.env.RELEASE_TAG, - body: require('fs').readFileSync('${{ github.workspace }}/release/release-body.md', 'utf8'), - target_commitish: '${{ github.ref_name }}' - }); +async function createRelease({github, context, core}, workspacePath, refName) { - const files = - [ - { name: 'OdbDesign-Linux-x64.zip', contentType: 'application/zip' }, - { name: 'OdbDesign-Linux-x64.zip.sha256sum', contentType: 'text/plain' }, - { name: 'OdbDesign-Linux-x64.zip.asc', contentType: 'text/plain' }, - { name: 'OdbDesign-Windows-x64.zip', contentType: 'application/zip' }, - { name: 'OdbDesign-Windows-x64.zip.sha256sum', contentType: 'text/plain' }, - { name: 'OdbDesign-Windows-x64.zip.asc', contentType: 'text/plain' }, - { name: 'OdbDesign-MacOS-x64.zip', contentType: 'application/zip' }, - { name: 'OdbDesign-MacOS-x64.zip.sha256sum', contentType: 'text/plain' }, - { name: 'OdbDesign-MacOS-x64.zip.asc', contentType: 'text/plain' } - ]; - - const artifactsPath = '${{ github.workspace }}/artifacts'; - - for (const file of files) { - const filePath = artifactsPath +'/' + file.name; - const uploadResponse = await github.rest.repos.uploadReleaseAsset({ + try { + const createResponse = await github.rest.repos.createRelease({ + generate_release_notes: true, + name: process.env.RELEASE_NAME, owner: context.repo.owner, repo: context.repo.repo, - release_id: createResponse.data.id, - name: file.name, - data: require('fs').readFileSync(filePath), - headers: { - 'content-type': file.contentType, - 'content-length': require('fs').statSync(filePath).size - } + prerelease: false, + tag_name: process.env.RELEASE_TAG, + body: require('fs').readFileSync(workspacePath + '/' + 'release/release-body.md', 'utf8'), + target_commitish: refName }); + + const files = + [ + { name: 'OdbDesign-Linux-x64.zip', contentType: 'application/zip' }, + { name: 'OdbDesign-Linux-x64.zip.sha256sum', contentType: 'text/plain' }, + { name: 'OdbDesign-Linux-x64.zip.asc', contentType: 'text/plain' }, + { name: 'OdbDesign-Windows-x64.zip', contentType: 'application/zip' }, + { name: 'OdbDesign-Windows-x64.zip.sha256sum', contentType: 'text/plain' }, + { name: 'OdbDesign-Windows-x64.zip.asc', contentType: 'text/plain' }, + { name: 'OdbDesign-MacOS-x64.zip', contentType: 'application/zip' }, + { name: 'OdbDesign-MacOS-x64.zip.sha256sum', contentType: 'text/plain' }, + { name: 'OdbDesign-MacOS-x64.zip.asc', contentType: 'text/plain' } + ]; + + const artifactsPath = workspacePath + '/' + 'artifacts'; + + for (const file of files) { + const filePath = artifactsPath + '/' + file.name; + const uploadResponse = await github.rest.repos.uploadReleaseAsset({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: createResponse.data.id, + name: file.name, + data: require('fs').readFileSync(filePath), + headers: { + 'content-type': file.contentType, + 'content-length': require('fs').statSync(filePath).size + } + }); + } + } catch (error) { + core.setFailed(error.message); } -} catch (error) { - core.setFailed(error.message); -} \ No newline at end of file + + return context.payload.client_payload.value +} + +module.exports = createRelease; \ No newline at end of file diff --git a/scripts/deploy.ps1 b/scripts/deploy.ps1 index a7b6ed3b..cdd73eac 100644 --- a/scripts/deploy.ps1 +++ b/scripts/deploy.ps1 @@ -14,7 +14,7 @@ if ($LASTEXITCODE -ne 0) { } # -# odbdesign-server-v1 +# odbdesign-server # # apply manifests @@ -38,5 +38,9 @@ kubectl apply -f deploy/kube/OdbDesignServer-SwaggerUI/service.yaml kubectl rollout restart deployment/odbdesign-server-swaggerui-v1 kubectl rollout status deployment/odbdesign-server-swaggerui-v1 +# +# common +# + # apply ingress manifest kubectl apply -f deploy/kube/default-ingress.yaml