Bump dependencies (#337) #359
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
name: cd-runtime | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: "environment" | |
required: true | |
default: "stage" | |
type: choice | |
options: | |
- stage | |
- prod | |
releasetag: | |
description: "releasetag" | |
required: true | |
type: string | |
push: | |
branches: | |
- main | |
env: | |
GOPRIVATE: "github.com/dgraph-io/*,github.com/gohypermode/*,github.com/hypermodeAI/*" | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
runtime-build-push: | |
if: ${{ github.event_name == 'push' }} | |
environment: stage | |
runs-on: warp-ubuntu-latest-x64-16x | |
steps: | |
- name: Configure git for private modules | |
env: | |
TOKEN: ${{ secrets.GO_PRIVATE_MODULES }} | |
run: git config --global url."https://admin-hypermode:${TOKEN}@github.com".insteadOf "https://github.com" | |
- uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
check-latest: true | |
- name: Runtime Git SHA | |
run: | | |
RUNTIME_GIT_SHA=$(git rev-parse --short HEAD) | |
echo "runtime git sha "$RUNTIME_GIT_SHA | |
echo "RUNTIME_GIT_SHA=$RUNTIME_GIT_SHA" >> $GITHUB_ENV | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: "${{ vars.AWS_ROLE }}" | |
role-session-name: CD_RUNTIME | |
aws-region: "${{ vars.AWS_REGION }}" | |
- name: Login to Amazon ECR | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push runtime docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
# see https://github.com/docker/build-push-action/issues/755 for why provenance=false | |
provenance: false | |
tags: | | |
${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com/hypermode/runtime:main-${{ env.RUNTIME_GIT_SHA }} | |
${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com/hypermode/runtime:latest | |
runtime-build-workflow-dispatch: | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
environment: "${{ github.event.inputs.environment }}" | |
runs-on: warp-ubuntu-latest-x64-16x | |
steps: | |
- name: Configure git for private modules | |
env: | |
TOKEN: ${{ secrets.GO_PRIVATE_MODULES }} | |
run: git config --global url."https://admin-hypermode:${TOKEN}@github.com".insteadOf "https://github.com" | |
- uses: actions/checkout@v4 | |
with: | |
ref: "${{ github.event.inputs.releasetag }}" | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
check-latest: true | |
- name: Set Runtime Release Version | |
run: | | |
#!/bin/bash | |
GIT_TAG_NAME='${{ github.event.inputs.releasetag }}' | |
if [[ "$GIT_TAG_NAME" == "v"* ]]; | |
then | |
echo "this is a release tag" | |
else | |
echo "this is NOT a release tag" | |
exit 1 | |
fi | |
RUNTIME_RELEASE_VERSION=$(echo $GIT_TAG_NAME | sed 's/runtime-//') | |
echo "making a new release for runtime "$RUNTIME_RELEASE_VERSION | |
echo "RUNTIME_RELEASE_VERSION=$RUNTIME_RELEASE_VERSION" >> $GITHUB_ENV | |
- name: Runtime Git SHA | |
run: | | |
RUNTIME_GIT_SHA=$(git rev-parse --short HEAD) | |
echo "runtime git sha "$RUNTIME_GIT_SHA | |
echo "RUNTIME_GIT_SHA=$RUNTIME_GIT_SHA" >> $GITHUB_ENV | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: "${{ vars.AWS_ROLE }}" | |
role-session-name: CD_RUNTIME | |
aws-region: "${{ vars.AWS_REGION }}" | |
- name: Login to Amazon ECR | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push runtime docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
# see https://github.com/docker/build-push-action/issues/755 for why provenance=false | |
provenance: false | |
tags: ${{ vars.AWS_ACCOUNT_ID }}.dkr.ecr.${{ vars.AWS_REGION }}.amazonaws.com/hypermode/runtime:${{ env.RUNTIME_RELEASE_VERSION }}-${{ env.RUNTIME_GIT_SHA }} |