Skip to content

Commit

Permalink
Set action step output vars in f# script directly
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Mar 19, 2024
1 parent 7f499cf commit 361fc8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 281 deletions.
6 changes: 2 additions & 4 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,8 @@ jobs:
needs: test-staging-area
runs-on: ubuntu-latest
outputs:
trigger-update-preview-index: ${{ steps.staging-area-pre-publish-checks.outputs.trigger-release-staging-area }}
trigger-publish-pending-packages: ${{ steps.staging-area-pre-publish-checks.outputs.trigger-publish-pending-packages }}
trigger-update-preview-index: ${{ steps.ppc.outputs.trigger-release-staging-area }}
trigger-publish-pending-packages: ${{ steps.ppc.outputs.trigger-publish-pending-packages }}
steps:
- uses: actions/checkout@v4
- name: Set up .NET
Expand All @@ -229,8 +229,6 @@ jobs:
id: ppc
run: |
dotnet fsi scripts/pre-publish-checks.fsx
echo "trigger-update-preview-index=$UPDATE_PREVIEW_INDEX" >> $GITHUB_OUTPUT
echo "trigger-publish-pending-packages=$PUBLISH_PENDING_PACKAGES" >> $GITHUB_OUTPUT
- name: list triggered jobs
run: |
echo "this should trigger the following jobs:"
Expand Down
274 changes: 0 additions & 274 deletions avpr-preview-index.json

This file was deleted.

10 changes: 7 additions & 3 deletions scripts/pre-publish-checks.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,14 @@ let staging_diff =
)

open System
open System.IO

// https://stackoverflow.com/questions/70123328/how-to-set-environment-variables-in-github-actions-using-python
let GITHUB_ENV = Environment.GetEnvironmentVariable("GITHUB_ENV")

if staging_diff.Length > 0 then
Environment.SetEnvironmentVariable("UPDATE_PREVIEW_INDEX", "true")
File.AppendAllLines(GITHUB_ENV, ["UPDATE_PREVIEW_INDEX=true"])
else
Environment.SetEnvironmentVariable("UPDATE_PREVIEW_INDEX", "false")
File.AppendAllLines(GITHUB_ENV, ["UPDATE_PREVIEW_INDEX=false"])

printfn $"""UPDATE_PREVIEW_INDEX={Environment.GetEnvironmentVariable("UPDATE_PREVIEW_INDEX")}"""
printfn $"""GITHUB_ENV={File.ReadAllText(GITHUB_ENV)}"""

0 comments on commit 361fc8e

Please sign in to comment.