Skip to content

Commit bbab16c

Browse files
committed
Bring release CI up to date
* 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
1 parent 8a814e7 commit bbab16c

File tree

1 file changed

+34
-8
lines changed

1 file changed

+34
-8
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# Note [environment variables]
2+
#
3+
# It seems absurd, but the syntax for creating environment variables
4+
# differs between Windows and Linux/MacOS. See
5+
#
6+
# https://docs.github.com/en/actions/learn-github-actions/variables
7+
#
8+
# In Linux/MacOS we have to use
9+
#
10+
# run: echo "VARNAME=content" >> "$GITHUB_ENV"
11+
#
12+
# whereas in Windows we have to use
13+
#
14+
# run: echo "VARNAME=content" >> $env:GITHUB_ENV
15+
116
name: Stan Release
217

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

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

94112
- name: Compress binary
95113
uses: svenstaro/upx-action@2.3.0
@@ -100,19 +118,27 @@ jobs:
100118
uses: actions/download-artifact@v3
101119
with:
102120
name: release_url
121+
path: release_url
122+
123+
# See Note [environment variables]
124+
- if: matrix.os == 'windows-latest'
125+
name: Get Release File Name & Upload URL on Widows
126+
run: |
127+
echo "upload_url=$(cat release_url/release_url.txt)" >> $env:GITHUB_ENV
103128
104-
- name: Get Release File Name & Upload URL
105-
id: get_release_info
129+
# See Note [environment variables]
130+
- if: matrix.os != 'windows-latest'
131+
name: Get Release File Name & Upload URL not on Widows
106132
run: |
107-
echo "::set-output name=upload_url::$(cat release_url/release_url.txt)"
133+
echo "upload_url=$(cat release_url/release_url.txt)" >> $GITHUB_ENV
108134
109135
- name: Upload Release Asset
110136
id: upload-release-asset
111137
uses: actions/upload-release-asset@v1.0.2
112138
env:
113139
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114140
with:
115-
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
141+
upload_url: ${{ env.upload_url }}
116142
asset_path: ${{ env.BINARY_PATH }}
117143
asset_name: stan-${{ steps.tag.outputs.tag }}-${{ runner.os }}-ghc-${{ matrix.ghc }}${{ env.EXT }}
118144
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)