Merge branch 'feature/graphql' into dev #18
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: Build and Package | |
on: | |
push: | |
branches: ['dev', 'release/*'] | |
# branches: ['dev'] | |
env: | |
DOTNET_INSTALL_DIR: "./.dotnet" | |
jobs: | |
publish: | |
runs-on: portkey-runner | |
strategy: | |
matrix: | |
servicename: [EoaServer.Silo,EoaServer.HttpApi.Host,EoaServer.EntityEventHandler,EoaServer.AuthServer] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0' # which dotnet version is required? | |
- run: dotnet publish src/${{ matrix.servicename }}/${{ matrix.servicename }}.csproj -o out/${{ matrix.servicename }} | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.servicename }} | |
path: out/${{ matrix.servicename }} | |
retention-days: 1 | |
build-and-push-image: | |
needs: publish | |
runs-on: portkey-runner | |
strategy: | |
matrix: | |
servicename: [EoaServer.Silo,EoaServer.HttpApi.Host,EoaServer.EntityEventHandler,EoaServer.AuthServer] | |
permissions: | |
contents: read | |
outputs: | |
short_sha: ${{ steps.vars.outputs.short_sha }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set short git commit SHA | |
id: vars | |
run: | | |
calculatedSha=$(git rev-parse --short ${{ github.sha }}) | |
echo "short_sha=$calculatedSha" >> "$GITHUB_OUTPUT" | |
- name: Download a single artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.servicename }} | |
path: out/${{ matrix.servicename }} | |
- name: Create image tag | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ secrets.REPOSITORY_REGION }}-docker.pkg.dev/${{ secrets.PROJECT_ID }}/${{ secrets.REPOSITORY }}/${{ matrix.servicename }} | |
tags: | | |
type=sha | |
- # Setting up Docker Buildx with docker-container driver is required | |
# at the moment to be able to use a subdirectory with Git context | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
build-args: | | |
servicename=${{ matrix.servicename }} | |
platforms: linux/amd64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
dispatch: | |
runs-on: portkey-runner | |
needs: build-and-push-image | |
steps: | |
- name: Deploy | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.TOK }} | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: 'Portkey-Wallet', | |
repo: 'devops', | |
workflow_id: 'deployment_testnet.yaml', | |
ref: 'master', | |
inputs: { | |
appName: 'portkey-eoa-backend', | |
commit_sha: 'sha-${{ needs.build-and-push-image.outputs.short_sha }}', | |
} | |
}) |