Skip to content

Commit

Permalink
Add jsr publish workflow, update docker workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
stwiname committed Oct 29, 2024
1 parent 10bc4f1 commit e256aca
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 34 deletions.
53 changes: 20 additions & 33 deletions .github/workflows/publish-docker.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
name: Docker Publish
on:
release:
types:
- published
workflow_dispatch:
inputs:
isLatest:
description: "Add latest tag"
default: "true"
required: true
push:
branches:
- 'main'
tags:
- 'v*'
pull_request:
branches:
- 'main'


jobs:
publish-docker:
name: publish-docker
runs-on: ubuntu-latest

permissions:
id-token: write # Needed for auth with Deno Deploy
contents: read # Needed to clone the repository

steps:
- uses: actions/checkout@v4

Expand All @@ -28,40 +25,30 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: subquerynetwork/subql-ai-app

- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: subquerynetwork
password: ${{ secrets.SQ_DOCKERHUB_TOKEN }}

# Read the version from deno.json
- name: Extract version
id: extract_version
run: |
version=$(cat deno.json | jq -r '.version')
echo "AI_APP_VERSION=$version" >> $GITHUB_ENV
- name: Build and push
if: github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'false'
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: arm64,amd64
file: ./Dockerfile
tags: subquerynetwork/subql-ai-app:v${{ env.AI_APP_VERSION }}
build-args: RELEASE_VERSION=${{ env.AI_APP_VERSION }}
- name: Update package deno.json
run: jq --arg version "${{ steps.meta.outputs.version }}" '.version = $version' deno.json > tmp.json && mv tmp.json deno.json

- name: Build and push
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.isLatest == 'true')
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: arm64,amd64
file: ./Dockerfile
tags: subquerynetwork/subql-ai-app:v${{ env.AI_APP_VERSION }},subquerynetwork/subql-ai-app:latest
build-args: RELEASE_VERSION=${{ env.AI_APP_VERSION }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
18 changes: 18 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# .github/workflows/publish.yml

name: Publish

on:
push:
tags:
- 'v*'

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write # The OIDC ID token is used for authentication with JSR.
steps:
- uses: actions/checkout@v4
- run: deno run -A jsr:@david/[email protected] --allow-slow-types
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@subql/ai-app-framework",
"version": "1.0.0-16",
"version": "0.0.0",
"exports": {
"./cli": "./src/index.ts",
".": "./src/mod.ts"
Expand Down

0 comments on commit e256aca

Please sign in to comment.