Skip to content

Publish Worker

Publish Worker #5

Workflow file for this run

name: Publish Worker
on:
release:
types: [ published ]
permissions:
packages: read
jobs:
docker-linux:
runs-on: ubuntu-latest
env:
IMAGE_NAME: dragonfruitdotnet/onionfruit-web:worker-linux-${{ github.event.release.tag_name }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.x'
- uses: docker/setup-qemu-action@v3
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup GitHub NuGet
run: dotnet nuget update source github --username USERNAME --password ${{ github.token }} --store-password-in-clear-text
- name: Build Worker
run: dotnet publish -c Release -p:UseAppHost=false -p:Version=${{ github.event.release.tag_name }} DragonFruit.OnionFruit.Web.Worker
- name: Docker Build and Push
uses: docker/build-push-action@v5
with:
context: DragonFruit.OnionFruit.Web.Worker/bin/Release/net7.0/publish
file: DragonFruit.OnionFruit.Web.Worker/Dockerfile
platforms: linux/arm64,linux/amd64
tags: ${{ env.IMAGE_NAME }}
push: true
docker-windows:
runs-on: windows-latest
env:
IMAGE_NAME: dragonfruitdotnet/onionfruit-web:worker-windows-${{ github.event.release.tag_name }}
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup GitHub NuGet
run: dotnet nuget update source github --username USERNAME --password ${{ github.token }} --store-password-in-clear-text
- name: Build Worker
run: dotnet publish -c Release -p:UseAppHost=false -p:Version=${{ github.event.release.tag_name }} DragonFruit.OnionFruit.Web.Worker
- name: Docker Build
run: docker build -f DragonFruit.OnionFruit.Web.Worker\Dockerfile -t ${{ env.IMAGE_NAME }} --build-arg "IMAGE_VARIANT=7.0-nanoserver-ltsc2022" DragonFruit.OnionFruit.Web.Worker\bin\Release\net7.0\publish
- name: Docker Push
run: docker push ${{ env.IMAGE_NAME }}
docker-multiarch-image:
runs-on: ubuntu-latest
needs:
- docker-linux
- docker-windows
steps:
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create MultiArch+MultiOS Manifest
run: docker buildx imagetools create -t dragonfruitdotnet/onionfruit-web:worker -t dragonfruitdotnet/onionfruit-web:worker-${{ github.event.release.tag_name }} dragonfruitdotnet/onionfruit-web:worker-windows-${{ github.event.release.tag_name }} dragonfruitdotnet/onionfruit-web:worker-linux-${{ github.event.release.tag_name }}