Skip to content

Merge pull request #251 from AelfScanProject/hotfix/worker-period-option #68

Merge pull request #251 from AelfScanProject/hotfix/worker-period-option

Merge pull request #251 from AelfScanProject/hotfix/worker-period-option #68

Workflow file for this run

name: Build and Deploy Release
on:
push:
tags:
- "v*.*.*"
env:
DOTNET_INSTALL_DIR: "./.dotnet"
jobs:
publish:
runs-on: aelfscan-runner
strategy:
matrix:
servicename:
[
AElfScanServer.Worker,
AElfScanServer.HttpApi.Host,
AElfScanServer.Silo,
AElfScanServer.AuthServer,
AElfScanServer.DbMigrator
]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0"
- 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: aelfscan-runner
strategy:
matrix:
servicename:
[
AElfScanServer.Worker,
AElfScanServer.HttpApi.Host,
AElfScanServer.Silo,
AElfScanServer.AuthServer,
AElfScanServer.DbMigrator
]
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v4
- 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=ref,event=tag
- 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 }}
dispatch:
runs-on: aelfscan-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: 'AelfScanProject',
repo: 'devops',
workflow_id: 'aelf-explorer-server-deploy.yaml',
ref: 'main',
inputs: {
env: 'production',
appName: 'aelf-explorer-backend',
commit_sha: '${{ github.ref_name }}',
}
})