Skip to content

Commit

Permalink
merge to release (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
nam20485 committed Feb 21, 2024
2 parents fda1cbd + a33e3e5 commit 8a8d8e5
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 100 deletions.
1 change: 1 addition & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ updates:
directory: /
schedule:
interval: weekly
#target-branch: nam20485
46 changes: 3 additions & 43 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}')
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ jobs:
uses: advanced-security/component-detection-dependency-submission-action@5a8ce4ad8c6fbb9b88f66f672014e44b427d7d54 # v0.0.2

- name: 'Dependency Review'
uses: actions/dependency-review-action@80f10bf419f34980065523f5efca7ebed17576aa # v4.1.0
uses: actions/dependency-review-action@9129d7d40b8c12c1ed0f60400d00c92d437adcce # v4.1.3
with:
comment-summary-in-pr: true
10 changes: 5 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}" \
}'
Original file line number Diff line number Diff line change
Expand Up @@ -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
84 changes: 46 additions & 38 deletions scripts/create-release.js
Original file line number Diff line number Diff line change
@@ -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);
}

return context.payload.client_payload.value
}

module.exports = createRelease;
6 changes: 5 additions & 1 deletion scripts/deploy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if ($LASTEXITCODE -ne 0) {
}

#
# odbdesign-server-v1
# odbdesign-server
#

# apply manifests
Expand All @@ -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

0 comments on commit 8a8d8e5

Please sign in to comment.