41 multi thread analysis process (#42) #62
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 API Container | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
env: | |
REGISTRY: ghcr.io | |
REPO: r-techsupport | |
IMAGE: webdbg-api | |
jobs: | |
build_and_push: | |
runs-on: windows-2022 | |
permissions: | |
contents: write | |
pull-requests: write | |
packages: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
run: | | |
$SHA = "${{ github.sha }}"[0..6] -join '' | |
if ("${{ github.ref }}" -eq 'refs/heads/main') { | |
$TAG = 'latest' | |
} else { | |
$TAG = 'devel' | |
} | |
echo "SHA=$SHA" >> $env:GITHUB_ENV | |
echo "TAG=$TAG" >> $env:GITHUB_ENV | |
Write-Host "Using tag: $TAG" | |
Write-Host "Using SHA: $SHA" | |
docker build -t ` | |
${{ env.REGISTRY }}/${{ env.REPO }}/${{ env.IMAGE }}:$TAG ` | |
-t ${{ env.REGISTRY }}/${{ env.REPO }}/${{ env.IMAGE }}:$SHA ` | |
api/ | |
docker push ${{ env.REGISTRY }}/${{ env.REPO }}/${{ env.IMAGE }}:$TAG | |
docker push ${{ env.REGISTRY }}/${{ env.REPO }}/${{ env.IMAGE }}:$SHA | |
- name: Log out from the Container registry | |
run: docker logout ${{ env.REGISTRY }} | |
- name: Comment on the PR | |
if: github.event_name == 'pull_request' | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
const tagImage = '${{ env.REGISTRY }}/${{ env.REPO }}/${{ env.IMAGE }}:${{ env.TAG }}'; | |
const shaImage = '${{ env.REGISTRY }}/${{ env.REPO }}/${{ env.IMAGE }}:${{ env.SHA }}'; | |
github.rest.issues.createComment({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.issue.number, | |
body: `Docker images have been built and pushed:\n- \`${tagImage}\`\n- \`${shaImage}\`` | |
}); |