Skip to content

Commit

Permalink
Bring release CI up to date
Browse files Browse the repository at this point in the history
* Avoid setting environment directly because it is deprecated.  It
  causes the error

  Error: Unable to process command '::set-env
  name=BINARY_PATH::./dist/stan' successfully.

  Error: The `set-env` command is disabled. Please upgrade to using
  Environment Files or opt into unsecure command execution by setting
  the `ACTIONS_ALLOW_UNSECURE_COMMANDS` environment variable to
  `true`. For more information see:
  https://github.blog/changelog/2020-10-01-github-actions-deprecating-set-env-and-add-path-commands/

* Specify path to create for artifact download because of API change

  See https://github.com/actions/download-artifact#compatibility-between-v1-and-v2v3
  • Loading branch information
tomjaguarpaw committed Oct 13, 2023
1 parent 8a814e7 commit bbab16c
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
# Note [environment variables]
#
# It seems absurd, but the syntax for creating environment variables
# differs between Windows and Linux/MacOS. See
#
# https://docs.github.com/en/actions/learn-github-actions/variables
#
# In Linux/MacOS we have to use
#
# run: echo "VARNAME=content" >> "$GITHUB_ENV"
#
# whereas in Windows we have to use
#
# run: echo "VARNAME=content" >> $env:GITHUB_ENV

name: Stan Release

on:
Expand Down Expand Up @@ -84,12 +99,15 @@ jobs:
mkdir dist
cabal install exe:stan --install-method=copy --overwrite-policy=always --installdir=dist
# See Note [environment variables]
- if: matrix.os == 'windows-latest'
name: Set extension to .exe on Windows
run: echo "::set-env name=EXT::.exe"
name: Set binary path name on Windows
run: echo "BINARY_PATH=./dist/stan.exe" >> $env:GITHUB_ENV

- name: Set binary path name
run: echo "::set-env name=BINARY_PATH::./dist/stan${{ env.EXT }}"
# See Note [environment variables]
- if: matrix.os != 'windows-latest'
name: Set binary path name not on Windows
run: echo "BINARY_PATH=./dist/stan" >> "$GITHUB_ENV"

- name: Compress binary
uses: svenstaro/[email protected]
Expand All @@ -100,19 +118,27 @@ jobs:
uses: actions/download-artifact@v3
with:
name: release_url
path: release_url

# See Note [environment variables]
- if: matrix.os == 'windows-latest'
name: Get Release File Name & Upload URL on Widows
run: |
echo "upload_url=$(cat release_url/release_url.txt)" >> $env:GITHUB_ENV
- name: Get Release File Name & Upload URL
id: get_release_info
# See Note [environment variables]
- if: matrix.os != 'windows-latest'
name: Get Release File Name & Upload URL not on Widows
run: |
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
echo "upload_url=$(cat release_url/release_url.txt)" >> $GITHUB_ENV
- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
upload_url: ${{ env.upload_url }}
asset_path: ${{ env.BINARY_PATH }}
asset_name: stan-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }}
asset_content_type: application/octet-stream

0 comments on commit bbab16c

Please sign in to comment.