Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure repo with release please and publish docker images #25

Merged
merged 6 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,19 @@ env:
jobs:
ci:
uses: uptick/actions/.github/workflows/ci.yaml@main
secrets: inherit
secrets:
SECRET_ENV: "${{ secrets.DEPLOY_KEY }}"
mdesouky marked this conversation as resolved.
Show resolved Hide resolved
with:
python: true
python-version: 3.11
praise-on-fix: false
poetry: true
poetry-install-command: "poetry install"
command: |
echo "$SECRET_ENV" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
GIT_SSH_COMMAND="ssh -i /tmp/deploy_key -o StrictHostKeyChecking=accept-new" git clone [email protected]:uptick/splat-private.git
mdesouky marked this conversation as resolved.
Show resolved Hide resolved
rm /tmp/deploy_key
curl https://mise.jdx.dev/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
echo "$HOME/.local/share/mise/shims" >> $GITHUB_PATH
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Release Please
on:
push:
branches:
- master

permissions:
actions: read # Read the metrics
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance / AWS

env:
CLUSTER_KEY: ${{secrets.CLUSTER_KEY}}

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
# Root level release_created
release_created: ${{ steps.release.outputs.release_created }}
# Root level tag_name
tag_name: ${{ steps.release.outputs.tag_name }}
sha: ${{ steps.release.outputs.sha }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with: {}

publish_docker_image:
name: Build and Push Docker Image
uses: uptick/actions/.github/workflows/ci.yaml@main
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
secrets:
SECRET_ENV: "${{ secrets.DEPLOY_KEY }}"
#https://github.com/uptick/actions/blob/main/.github/workflows/ci.yaml
with:
aws-iam-role-arn: "arn:aws:iam::610829907584:role/default-github-actions-ci-role"
docker-enabled: true
docker-context: "."
docker-tag: "${{ needs.release-please.outputs.tag_name }}"
docker-tag-latest: true
docker-image-platforms: linux/amd64
docker-repository: "610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/splat"
command: |
echo "$SECRET_ENV" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
GIT_SSH_COMMAND="ssh -i /tmp/deploy_key -o StrictHostKeyChecking=accept-new" git clone [email protected]:uptick/splat-private.git
rm /tmp/deploy_key
36 changes: 36 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Test
on:
push:
branches:
- master
pull_request: ~

permissions:
actions: read # Read the metrics
contents: write # to be able to publish a GitHub release
issues: write # to be able to comment on released issues
pull-requests: write # to be able to comment on released pull requests
id-token: write # to enable use of OIDC for npm provenance / AWS

jobs:
build:
name: Build and Push Docker Image
uses: uptick/actions/.github/workflows/ci.yaml@main
secrets:
SECRET_ENV: "${{ secrets.DEPLOY_KEY }}"
#https://github.com/uptick/actions/blob/main/.github/workflows/ci.yaml
with:
aws-iam-role-arn: "arn:aws:iam::610829907584:role/default-github-actions-ci-role"
docker-enabled: true
docker-context: "."
docker-prefix: test
docker-tag-latest: false
docker-image-platforms: linux/amd64
docker-push: false
docker-repository: "610829907584.dkr.ecr.ap-southeast-2.amazonaws.com/splat"
command: |
echo "$SECRET_ENV" > /tmp/deploy_key
chmod 600 /tmp/deploy_key
GIT_SSH_COMMAND="ssh -i /tmp/deploy_key -o StrictHostKeyChecking=accept-new" git clone [email protected]:uptick/splat-private.git
rm /tmp/deploy_key

3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.1.8"
}
Empty file added CHANGELOG.md
Empty file.
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Define function directory
ARG FUNCTION_DIR="/var/task"

FROM mcr.microsoft.com/playwright/python:v1.43.0-jammy as build-image
FROM mcr.microsoft.com/playwright/python:v1.43.0-jammy AS build-image

# Install aws-lambda-cpp build dependencies
RUN apt-get update && \
Expand Down Expand Up @@ -55,10 +55,11 @@ RUN curl -O -J https://www.princexml.com/download/prince-14.2-aws-lambda.zip &&
rm prince-14.2-aws-lambda.zip


CMD rm -rf /var/task/fonts || true
COPY font[s] /var/task/fonts
RUN rm -rf /var/task/fonts || true
RUN mkdir -p /var/task/fonts || true
COPY license.dat ./prince-engine/license/license.dat
COPY splat-private/font[s] /var/task/fonts

COPY splat-private/license.dat ./prince-engine/license/license.dat
COPY lambda_function.py ./

ENTRYPOINT [ "/entry_script.sh","lambda_function.lambda_handler" ]
12 changes: 12 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"packages": {
".": {
"package-name": "splat",
"release-type": "python",
"changelog-path": "CHANGELOG.md",
"exclude-paths": [
"tests/"
]
}
}
}
Loading