fix(ci): inline version parsing everywhere (act_runner steps.outputs broken)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
+34
-30
@@ -266,10 +266,20 @@ jobs:
|
||||
else { Write-Host "already patched" }
|
||||
|
||||
Write-Host "=== STEP C: msbuild /t:Publish (VSTO ClickOnce publish target) ==="
|
||||
# Resolve version inline -- act_runner doesn't propagate steps.outputs
|
||||
# between steps reliably, so don't depend on the "Compute version" step.
|
||||
$tag = "${{ github.ref_name }}"
|
||||
if ($tag -notmatch '^v(\d+\.\d+\.\d+)$') {
|
||||
throw "Tag '$tag' is not in vMAJOR.MINOR.PATCH form"
|
||||
}
|
||||
$version = "$($Matches[1]).0"
|
||||
$versionDot = $Matches[1]
|
||||
$versionUscore = $version -replace '\.','_'
|
||||
Write-Host " version=$version versionUscore=$versionUscore"
|
||||
|
||||
# /t:Publish is the standard VSTO publish target: it builds, signs
|
||||
# assemblies, generates and signs the manifests, copies everything
|
||||
# into the PublishDir, and renames payload files to .deploy. We
|
||||
# don't need separate mage/signtool calls.
|
||||
# into the PublishDir, and renames payload files to .deploy.
|
||||
$publishDir = (Resolve-Path .).Path + "\publish\"
|
||||
$msbuildArgs = @(
|
||||
'OutlookAddin.sln',
|
||||
@@ -277,11 +287,11 @@ jobs:
|
||||
'/t:Publish',
|
||||
'/p:Configuration=Release',
|
||||
'/p:Platform="Any CPU"',
|
||||
'/p:PublishDir=' + $publishDir,
|
||||
('/p:PublishDir={0}' -f $publishDir),
|
||||
'/p:InstallUrl=https://platform.dev.marcus-law.co.il/outlook-addin/',
|
||||
'/p:UpdateUrl=https://platform.dev.marcus-law.co.il/outlook-addin/',
|
||||
'/p:ApplicationVersion=' + $env:VERSION,
|
||||
'/p:MinimumRequiredVersion=' + $env:VERSION,
|
||||
('/p:ApplicationVersion={0}' -f $version),
|
||||
('/p:MinimumRequiredVersion={0}' -f $version),
|
||||
'/m',
|
||||
'/flp:logfile=publish-msbuild.log;verbosity=detailed'
|
||||
)
|
||||
@@ -325,13 +335,16 @@ jobs:
|
||||
env:
|
||||
REG_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REG_PASS: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
VER: ${{ steps.ver.outputs.versionDot }}
|
||||
run: |
|
||||
# Re-parse version inline (act_runner does not propagate steps.outputs).
|
||||
$tag = "${{ github.ref_name }}"
|
||||
if ($tag -notmatch '^v(\d+\.\d+\.\d+)$') { throw "tag $tag not in vMAJOR.MINOR.PATCH" }
|
||||
$versionDot = $Matches[1]
|
||||
$pair = "$($env:REG_USER):$($env:REG_PASS)"
|
||||
$auth = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes($pair))
|
||||
$uri = "https://gitea.dev.marcus-law.co.il/api/packages/espocrm-extensions/generic/outlook-addin-publish/$($env:VER)/publish.tar.gz"
|
||||
$uri = "https://gitea.dev.marcus-law.co.il/api/packages/espocrm-extensions/generic/outlook-addin-publish/$versionDot/publish.tar.gz"
|
||||
Invoke-WebRequest -Method Put -Uri $uri -Headers @{ Authorization = $auth } -InFile publish.tar.gz -ContentType 'application/gzip' -UseBasicParsing | Out-Null
|
||||
Write-Host "Uploaded $((Get-Item publish.tar.gz).Length) bytes."
|
||||
Write-Host "Uploaded $((Get-Item publish.tar.gz).Length) bytes to $uri"
|
||||
|
||||
- name: Push publish logs to generic package
|
||||
if: always()
|
||||
@@ -364,46 +377,36 @@ jobs:
|
||||
- name: Checkout (Dockerfile + nginx.conf)
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Compute version from tag
|
||||
id: ver
|
||||
- name: Download publish artifact + build + push image
|
||||
env:
|
||||
REG_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REG_PASS: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
set -e
|
||||
# act_runner does not propagate steps.outputs between steps, so parse
|
||||
# the tag inline.
|
||||
TAG="${GITHUB_REF##refs/tags/}"
|
||||
if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
|
||||
echo "Tag $TAG is not in vMAJOR.MINOR.PATCH form" >&2
|
||||
exit 1
|
||||
fi
|
||||
VERSION="${TAG#v}"
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "tag=$TAG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Download publish artifact from Gitea generic package
|
||||
env:
|
||||
REG_USER: ${{ secrets.REGISTRY_USER }}
|
||||
REG_PASS: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
run: |
|
||||
set -e
|
||||
URL="https://gitea.dev.marcus-law.co.il/api/packages/espocrm-extensions/generic/outlook-addin-publish/${{ steps.ver.outputs.version }}/publish.tar.gz"
|
||||
URL="https://gitea.dev.marcus-law.co.il/api/packages/espocrm-extensions/generic/outlook-addin-publish/${VERSION}/publish.tar.gz"
|
||||
curl -sfL -u "$REG_USER:$REG_PASS" "$URL" -o publish.tar.gz
|
||||
mkdir -p cdn
|
||||
tar -xzf publish.tar.gz -C cdn
|
||||
ls -la cdn/publish/
|
||||
|
||||
- name: Login to Gitea Registry
|
||||
run: |
|
||||
echo "${{ secrets.REGISTRY_PASSWORD }}" | \
|
||||
docker login ${{ env.REGISTRY }} \
|
||||
-u "${{ secrets.REGISTRY_USER }}" --password-stdin
|
||||
|
||||
- name: Build and push image
|
||||
run: |
|
||||
echo "$REG_PASS" | docker login ${{ env.REGISTRY }} -u "$REG_USER" --password-stdin
|
||||
BASE="${{ env.REGISTRY }}/${{ env.CDN_IMAGE_NAME }}"
|
||||
docker build \
|
||||
-t "${BASE}:latest" \
|
||||
-t "${BASE}:${{ steps.ver.outputs.tag }}" \
|
||||
-t "${BASE}:${TAG}" \
|
||||
-t "${BASE}:build-${{ github.run_number }}" \
|
||||
cdn/
|
||||
docker push "${BASE}:latest"
|
||||
docker push "${BASE}:${{ steps.ver.outputs.tag }}"
|
||||
docker push "${BASE}:${TAG}"
|
||||
docker push "${BASE}:build-${{ github.run_number }}"
|
||||
|
||||
- name: Trigger Coolify redeploy
|
||||
@@ -419,7 +422,8 @@ jobs:
|
||||
WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK_RELEASES }}
|
||||
run: |
|
||||
if [ -z "$WEBHOOK" ]; then exit 0; fi
|
||||
VERSION="${{ steps.ver.outputs.version }}"
|
||||
TAG="${GITHUB_REF##refs/tags/}"
|
||||
VERSION="${TAG#v}"
|
||||
curl -sf -X POST -H 'Content-Type: application/json' "$WEBHOOK" -d "$(cat <<EOF
|
||||
{
|
||||
"text": ":package: **OutlookAddin v$VERSION** שוחרר — https://platform.dev.marcus-law.co.il/outlook-addin/OutlookAddin.vsto",
|
||||
|
||||
Reference in New Issue
Block a user