Skip to content

Commit

Permalink
Upgrade GitHub Actions workflow to use GITHUB_ENV instead of set-env op
Browse files Browse the repository at this point in the history
  • Loading branch information
yoshihitoh committed Dec 5, 2020
1 parent 7cd83ee commit bea4674
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Release
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+*'

env:
APP_NAME: refmt
Expand All @@ -19,8 +19,11 @@ jobs:
- name: Get the release version from the tag
if: env.APP_VERSION == ''
run: |
echo "::set-env name=APP_VERSION::${GITHUB_REF#refs/tags/}"
echo "version is: ${{ env.APP_VERSION }}"
echo "APP_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Confirm the app version
run: |
echo "Version is: ${{ env.APP_VERSION }}"
- name: Create GitHub release
id: release
Expand Down Expand Up @@ -102,10 +105,13 @@ jobs:
shell: bash
run: |
release_upload_url="$(cat artifacts/release-upload-url)"
echo "::set-env name=RELEASE_UPLOAD_URL::$release_upload_url"
RELEASE_UPLOAD_URL="$release_upload_url"
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
echo "release upload url: $RELEASE_UPLOAD_URL"
release_version="$(cat artifacts/release-version)"
echo "::set-env name=RELEASE_VERSION::$release_version"
RELEASE_VERSION="$release_version"
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
echo "release version: $RELEASE_VERSION"
- name: Build release binary
Expand All @@ -122,25 +128,25 @@ jobs:
"$PWD/target:/target:Z" \
rustembedded/cross:arm-unknown-linux-gnueabihf \
arm-linux-gnueabihf-strip \
/target/arm-unknown-linux-gnueabihf/release/ut
/target/arm-unknown-linux-gnueabihf/release/${{ env.APP_NAME }}
- name: Build archive
shell: bash
run: |
# NOTE: Consider adding script files to do below operations.
staging="ut-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
staging="${{ env.APP_NAME }}-${{ env.RELEASE_VERSION }}-${{ matrix.target }}"
mkdir -p "$staging"
cp README.md LICENSE-MIT "$staging/"
cp README.md LICENSE "$staging/"
if [ "${{ matrix.os }}" = "windows-2019" ]; then
cp "target/${{ matrix.target }}/release/${{ env.APP_NAME }}.exe" "$staging/"
7z a "$staging.zip" "$staging"
echo "::set-env name=ASSET::$staging.zip"
echo "ASSET=$staging.zip" >> $GITHUB_ENV
else
cp "target/${{ matrix.target }}/release/${{ env.APP_NAME }}" "$staging/"
tar czf "$staging.tar.gz" "$staging"
echo "::set-env name=ASSET::$staging.tar.gz"
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
fi
- name: Upload release archive
Expand Down

0 comments on commit bea4674

Please sign in to comment.