Skip to content

Commit

Permalink
merge to release (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
nam20485 committed Jan 31, 2024
2 parents e759f9e + c0ef4be commit 2a2bc3b
Show file tree
Hide file tree
Showing 72 changed files with 1,833 additions and 526 deletions.
112 changes: 1 addition & 111 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: CMake Build Multi-Platform

on:
push:
branches: [ "development", "main", "release", "nam20485" ]
branches: [ "nam20485" ]
pull_request:
branches: [ "development", "main", "release", "nam20485" ]

Expand Down Expand Up @@ -212,113 +212,3 @@ jobs:
name: ${{ matrix.os }}-artifacts
path: ${{ env.ARTIFACTS_DIR }}/artifacts-${{matrix.os}}.zip
retention-days: 1

#
# Create Release job
#

release:
# only on pushes to the release branch
name: Create Release
needs: build
if: ${{ (github.ref_name == 'release') && github.event_name == 'push' }}
runs-on: ubuntu-22.04
permissions:
contents: write

steps:

- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

# download the artifacts
- name: "Download artifacts"
uses: "actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935" # v4.1.1
with:
path: ${{ github.workspace }}/artifacts

- name: Rename Artifacts
run: |
mv ${{ github.workspace }}/artifacts/ubuntu-22.04-artifacts/artifacts-ubuntu-22.04.zip ${{ github.workspace }}/artifacts/OdbDesign-Linux-x64.zip
mv ${{ github.workspace }}/artifacts/windows-2022-artifacts/artifacts-windows-2022.zip ${{ github.workspace }}/artifacts/OdbDesign-Windows-x64.zip
mv ${{ github.workspace }}/artifacts/macos-12-artifacts/artifacts-macos-12.zip ${{ github.workspace }}/artifacts/OdbDesign-MacOS-x64.zip
- name: Generate SHA256 Sums
run: |
# sha256
cd ${{ github.workspace }}/artifacts
sha256sum OdbDesign-Linux-x64.zip > OdbDesign-Linux-x64.zip.sha256sum
sha256sum OdbDesign-Windows-x64.zip > OdbDesign-Windows-x64.zip.sha256sum
sha256sum OdbDesign-MacOS-x64.zip > OdbDesign-MacOS-x64.zip.sha256sum
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}

- name: Sign Binaries
run: |
cd ${{ github.workspace }}/artifacts
gpg --batch --yes --detach-sign --armor OdbDesign-Linux-x64.zip
gpg --batch --yes --detach-sign --armor OdbDesign-Windows-x64.zip
gpg --batch --yes --detach-sign --armor OdbDesign-MacOS-x64.zip
- name: Create Release Variables
run: |
export RELEASE_VERSION="${{vars.RELEASE_VERSION_PREFIX}}.${{github.run_number}}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
export RELEASE_TAG="v${RELEASE_VERSION}"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
export RELEASE_NAME="OdbDesign ${RELEASE_TAG}"
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
# create a release
- name: "Create GitHub Release"
uses: "actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea" # v7.0.1
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.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);
}
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ name: "CodeQL Security Scan"

on:
push:
branches: [ "development", "main", "release", "nam20485" ]
branches: [ "nam20485" ]
pull_request:
branches: [ "development", "main", "release", "nam20485" ]

Expand Down
122 changes: 122 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# run CMake build on Windows and Linux
name: Create Release

on:
push:
branches: [ "release" ]

permissions:
contents: read

env:
ARTIFACTS_DIR: ${{ github.workspace }}/artifacts
ARTIFACTS_DIR_WIN: ${{ github.workspace }}\artifacts

jobs:

release:

# only on pushes to the release branch
name: Create Release
#needs: build
if: ${{ (github.ref_name == 'release') && github.event_name == 'push' }}
runs-on: ubuntu-22.04
permissions:
contents: write

steps:

- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

# download the artifacts
- name: "Download artifacts"
uses: "actions/download-artifact@6b208ae046db98c579e8a3aa621ab581ff575935" # v4.1.1
with:
path: ${{ github.workspace }}/artifacts

- name: Rename Artifacts
run: |
mv ${{ github.workspace }}/artifacts/ubuntu-22.04-artifacts/artifacts-ubuntu-22.04.zip ${{ github.workspace }}/artifacts/OdbDesign-Linux-x64.zip
mv ${{ github.workspace }}/artifacts/windows-2022-artifacts/artifacts-windows-2022.zip ${{ github.workspace }}/artifacts/OdbDesign-Windows-x64.zip
mv ${{ github.workspace }}/artifacts/macos-12-artifacts/artifacts-macos-12.zip ${{ github.workspace }}/artifacts/OdbDesign-MacOS-x64.zip
- name: Generate SHA256 Sums
run: |
# sha256
cd ${{ github.workspace }}/artifacts
sha256sum OdbDesign-Linux-x64.zip > OdbDesign-Linux-x64.zip.sha256sum
sha256sum OdbDesign-Windows-x64.zip > OdbDesign-Windows-x64.zip.sha256sum
sha256sum OdbDesign-MacOS-x64.zip > OdbDesign-MacOS-x64.zip.sha256sum
- name: Import GPG Key
uses: crazy-max/ghaction-import-gpg@01dd5d3ca463c7f10f7f4f7b4f177225ac661ee4 # v6.1.0
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}

- name: Sign Binaries
run: |
cd ${{ github.workspace }}/artifacts
gpg --batch --yes --detach-sign --armor OdbDesign-Linux-x64.zip
gpg --batch --yes --detach-sign --armor OdbDesign-Windows-x64.zip
gpg --batch --yes --detach-sign --armor OdbDesign-MacOS-x64.zip
- name: Create Release Variables
run: |
export RELEASE_VERSION="${{vars.RELEASE_VERSION_PREFIX}}.${{github.run_number}}"
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
export RELEASE_TAG="v${RELEASE_VERSION}"
echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV
export RELEASE_NAME="OdbDesign ${RELEASE_TAG}"
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV
# create a release
- name: "Create GitHub Release"
uses: "actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea" # v7.0.1
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.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);
}
94 changes: 94 additions & 0 deletions .github/workflows/deploy-eks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# This workflow will build and push a new container image to Amazon ECR,
# and then will deploy a new task definition to Amazon ECS, when there is a push to the "development" branch.
#
# To use this workflow, you will need to complete the following set-up steps:
#
# 1. Create an ECR repository to store your images.
# For example: `aws ecr create-repository --repository-name my-ecr-repo --region us-east-2`.
# Replace the value of the `ECR_REPOSITORY` environment variable in the workflow below with your repository's name.
# Replace the value of the `AWS_REGION` environment variable in the workflow below with your repository's region.
#
# 2. Create an ECS task definition, an ECS cluster, and an ECS service.
# For example, follow the Getting Started guide on the ECS console:
# https://us-east-2.console.aws.amazon.com/ecs/home?region=us-east-2#/firstRun
# Replace the value of the `ECS_SERVICE` environment variable in the workflow below with the name you set for the Amazon ECS service.
# Replace the value of the `ECS_CLUSTER` environment variable in the workflow below with the name you set for the cluster.
#
# 3. Store your ECS task definition as a JSON file in your repository.
# The format should follow the output of `aws ecs register-task-definition --generate-cli-skeleton`.
# Replace the value of the `ECS_TASK_DEFINITION` environment variable in the workflow below with the path to the JSON file.
# Replace the value of the `CONTAINER_NAME` environment variable in the workflow below with the name of the container
# in the `containerDefinitions` section of the task definition.
#
# 4. Store an IAM user access key in GitHub Actions secrets named `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
# See the documentation for each action used below for the recommended IAM policies for this IAM user,
# and best practices on handling the access key credentials.

name: Deploy to Amazon ECS

on:
push:
branches: [ "development" ]

env:
AWS_REGION: MY_AWS_REGION # set this to your preferred AWS region, e.g. us-west-1
ECR_REPOSITORY: MY_ECR_REPOSITORY # set this to your Amazon ECR repository name
ECS_SERVICE: MY_ECS_SERVICE # set this to your Amazon ECS service name
ECS_CLUSTER: MY_ECS_CLUSTER # set this to your Amazon ECS cluster name
ECS_TASK_DEFINITION: MY_ECS_TASK_DEFINITION # set this to the path to your Amazon ECS task definition
# file, e.g. .aws/task-definition.json
CONTAINER_NAME: MY_CONTAINER_NAME # set this to the name of the container in the
# containerDefinitions section of your task definition

permissions:
contents: read

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
environment: production

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
IMAGE_TAG: ${{ github.sha }}
run: |
# Build a docker container and
# push it to ECR so that it can
# be deployed to ECS.
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "image=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_OUTPUT
- name: Fill in the new image ID in the Amazon ECS task definition
id: task-def
uses: aws-actions/amazon-ecs-render-task-definition@v1
with:
task-definition: ${{ env.ECS_TASK_DEFINITION }}
container-name: ${{ env.CONTAINER_NAME }}
image: ${{ steps.build-image.outputs.image }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.task-def.outputs.task-definition }}
service: ${{ env.ECS_SERVICE }}
cluster: ${{ env.ECS_CLUSTER }}
wait-for-service-stability: true
4 changes: 2 additions & 2 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ name: Docker Publish
on:
push:
branches: [ "development", "main", "release", "nam20485" ]
pull_request:
branches: [ "development", "main", "release", "nam20485" ]
#pull_request:
# branches: [ "development", "main", "release", "nam20485" ]

env:
# Use docker.io for Docker Hub if empty
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-scout-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Docker Scout Scan

on:
push:
branches: [ "development", "main", "release", "nam20485" ]
branches: [ "nam20485" ]
pull_request:
branches: [ "development", "main", "release", "nam20485" ]

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ on:
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
schedule:
- cron: '26 13 * * 3'
push:
branches: [ "development" ]
#push:
# branches: [ "development" ]
pull_request:
branches: [ "development" ]

Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,5 @@ if (DOXYGEN_FOUND)
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
else (DOXYGEN_FOUND)
message("Doxygen need to be installed to generate the doxygen documentation")
message("Doxygen needs to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND)
Loading

0 comments on commit 2a2bc3b

Please sign in to comment.