Update main_build-aspnetcore.yml #75
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 ASP.NET Core and Reporting REST Service | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- "aspnetcore/*" | |
paths: | |
- 'src/AspNetCore/**/*' | |
- '.github/workflows/main_build-aspnetcore.yml' | |
jobs: | |
# A job that containerizes an ASP.NET Core web app with Relerik Reporting REST service and publish to Docker Hub | |
build_aspnetcore: | |
runs-on: ubuntu-22.04 | |
# REQUIRED For 'akeyless' step | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
# Getting all my secrets from AKeyless is a personal choice, you can use GitHub Actions secrets instead. | |
- name: Fetch secrets from AKeyless | |
id: akeyless | |
uses: LanceMcCarthy/akeyless-action@v3 | |
with: | |
access-id: ${{ secrets.AKEYLESS_JWT_ID }} | |
static-secrets: '{"/personal-keys/mccarthy/TELERIK_NUGET_KEY":"TELERIK_NUGET_KEY", "/personal-keys/mccarthy/DOCKER_HUB_USERNAME":"DOCKER_HUB_USERNAME", "/personal-keys/mccarthy/DOCKER_HUB_PAT":"DOCKER_HUB_PAT"}' | |
export-secrets-to-outputs: true | |
export-secrets-to-environment: false | |
- name: Create Kendo license file in the appropriate project directory | |
run: | | |
cd src/AspNetCore/MyAspNetCoreApp/wwwroot/js | |
echo ${{ steps.akeyless.outputs.KENDO_LICENSE_FILE }} > kendo-ui-license.js | |
- name: Generate a version number for new tag | |
id: tag-creator | |
run: | | |
buildDay=`date +%Y.%m.%d` | |
tags="lancemccarthy/myaspnetcoreapp:$buildDay.$GITHUB_RUN_NUMBER" | |
echo "DOCKER_HUB_TAG=$tags" >> $GITHUB_OUTPUT | |
- name: Verify tag output | |
run: echo ${{ steps.tag-creator.outputs.DOCKER_HUB_TAG }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Get package metadata from Docker Hub | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: lancemccarthy/myaspnetcoreapp | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ steps.akeyless.outputs.DOCKER_HUB_USERNAME }} | |
password: ${{ steps.akeyless.outputs.DOCKER_HUB_PAT }} | |
- name: Build and push to Docker Hub | |
uses: docker/build-push-action@v5 | |
with: | |
context: src/AspNetCore/MyAspNetCoreApp | |
platforms: linux/arm64,linux/amd64 | |
push: true | |
secrets: | | |
telerik_key=${{ steps.akeyless.outputs.TELERIK_NUGET_KEY }} | |
tags: | | |
${{ steps.tag-creator.outputs.DOCKER_HUB_TAG }} | |
lancemccarthy/myaspnetcoreapp:latest |