-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
72 changed files
with
1,833 additions
and
526 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
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); | ||
} |
This file contains 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
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 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.