Skip to content

changed versioning scheme on non release builds #34

changed versioning scheme on non release builds

changed versioning scheme on non release builds #34

Workflow file for this run

name: cicd
on:
push:
branches:
- main
- "feature/*"
- "bugfix/*"
paths-ignore:
- "*.md"
env:
LINUX_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/eee-linux
WINDOWS_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/eee-ltsc2025
MULTIARCH_IMAGE_REPO: ghcr.io/${{ github.repository_owner }}/eee
PROJECT_PATH: src/ExperienceEdgeEmu.Web/ExperienceEdgeEmu.Web.csproj
jobs:
get_version:
name: Generate version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.value }}
steps:
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v9
with:
replace_slashes_with_hyphens: true
strip_tag_prefix: v
- name: Generate version
id: version
run: |
IS_TAG="${{ steps.branch-name.outputs.is_tag }}"
if [ "$IS_TAG" == "true" ]; then
VERSION="${{ steps.branch-name.outputs.is_tag }}"
else
VERSION="${{ steps.branch-name.outputs.current_branch }}-${{ github.run_number }}"
fi
echo "value=$VERSION" >> $GITHUB_OUTPUT
echo "Version is: $VERSION"
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
needs: get_version
permissions:
contents: read
packages: write
strategy:
matrix:
include:
- os: ubuntu-latest
runtime: linux-x64
repo: ghcr.io/${{ github.repository_owner }}/eee-linux
base_image: ""
- os: windows-2025
runtime: win-x64
repo: ghcr.io/${{ github.repository_owner }}/eee-ltsc2025
base_image: "/p:ContainerBaseImage=mcr.microsoft.com/dotnet/aspnet:9.0-nanoserver-ltsc2025"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
cache: true
cache-dependency-path: "**/packages.lock.json"
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: dotnet restore
run: dotnet restore --locked-mode
- name: dotnet publish as local Docker image (versioned)
run: >
dotnet publish ${{ env.PROJECT_PATH }}
-c Release
/t:PublishContainer
/p:ContainerRuntimeIdentifier=${{ matrix.runtime }}
/p:ContainerRepository=${{ matrix.repo }}
/p:ContainerImageTag=${{ needs.get_version.outputs.version }}
${{ matrix.base_image }}
- name: Push image (versioned)
run: docker image push ${{ matrix.repo }}:${{ needs.get_version.outputs.version }}
- name: Tag and push image (latest)
if: github.ref_type == 'tag'
run: |
docker image tag ${{ matrix.repo }}:${{ needs.get_version.outputs.version }} ${{ matrix.repo }}:latest
docker image push ${{ matrix.repo }}:latest
- name: dotnet publish binary
run: dotnet publish ${{ env.PROJECT_PATH }} -c Release -r ${{ matrix.runtime }} --self-contained -p:PublishSingleFile=true -o ./release/${{ matrix.runtime }}
- name: Upload binary artifact
uses: actions/upload-artifact@v4
with:
name: eee-${{ matrix.runtime }}
path: release/${{ matrix.runtime }}
create_manifest:
name: Create Docker manifests
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: [get_version, build]
permissions:
packages: write
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push multi-arch manifest (versioned)
run: |
docker manifest create ${{ env.MULTIARCH_IMAGE_REPO }}:${{ needs.get_version.outputs.version }} --amend ${{ env.WINDOWS_IMAGE_REPO }}:${{ needs.get_version.outputs.version }} --amend ${{ env.LINUX_IMAGE_REPO }}:${{ needs.get_version.outputs.version }}
docker manifest push ${{ env.MULTIARCH_IMAGE_REPO }}:${{ needs.get_version.outputs.version }}
- name: Create and push multi-arch manifest (latest)
run: |
docker manifest create ${{ env.MULTIARCH_IMAGE_REPO }}:latest --amend ${{ env.WINDOWS_IMAGE_REPO }}:latest --amend ${{ env.LINUX_IMAGE_REPO }}:latest
docker manifest push ${{ env.MULTIARCH_IMAGE_REPO }}:latest
create_release:
name: Create release
if: github.ref_type == 'tag'
runs-on: ubuntu-latest
needs: [get_version, build]
steps:
- uses: actions/download-artifact@v5
name: Download artifact (Windows)
with:
name: eee-win-x64
path: release/win-x64
- uses: actions/download-artifact@v5
name: Download artifact (linux)
with:
name: eee-linux-x64
path: release/linux-x64
- uses: softprops/action-gh-release@v2
name: Create Release
with:
tag_name: v${{ needs.get_version.outputs.version }}
name: v${{ needs.get_version.outputs.version }}
prerelease: ${{ github.ref != 'refs/heads/main' }}
generate_release_notes: true
files: |
release/win-x64/eee.exe
release/linux-x64/eee