Skip to content

Fix tag_name variable reference in GitHub Actions workflow #60

Fix tag_name variable reference in GitHub Actions workflow

Fix tag_name variable reference in GitHub Actions workflow #60

Workflow file for this run

name: Build Artifacts
on:
push:
branches:
- build
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
steps:
- name: Install Rust and Cross
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
cargo install cross
else
sudo apt-get update
sudo apt-get install -y musl-tools
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
cargo install cross
fi
- name: Check out code
uses: actions/checkout@v2
- name: Generate artifacts
run: |
if [[ "${{ runner.os }}" == "macOS" ]]; then
cargo build --release --target x86_64-apple-darwin
mkdir -p earendil.app/Contents/MacOS
cp target/x86_64-apple-darwin/release/earendil earendil.app/Contents/MacOS/earendil
zip -r earendil-macos.zip earendil.app
echo "ARTIFACT_PATH=earendil-macos.zip" >> $GITHUB_ENV
else
cd utilities/earendil-gui
cross build --target x86_64-pc-windows-gnu --release
zip earendil-windows.zip ../../target/x86_64-pc-windows-gnu/release/earendil-gui.exe
echo "ARTIFACT_PATH=earendil-windows.zip" >> $GITHUB_ENV
fi
env:
PKG_CONFIG_ALLOW_CROSS: 1
- name: Get Release Version
run: |
echo "GUI_VERSION=$(cargo pkgid | cut -d'#' -f2)" >> $GITHUB_ENV
if [[ "${{ runner.os }}" == "macOS" ]]; then
echo "TAG_NAME=macos-${{ env.GUI_VERSION }}" >> $GITHUB_ENV
else
echo "TAG_NAME=windows-${{ env.GUI_VERSION }}" >> $GITHUB_ENV
fi
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.TAG_NAME }}
release_name: Release ${{ env.GUI_VERSION }}
draft: false
prerelease: false
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./${{ env.ARTIFACT_PATH }}
asset_name: ${{ env.ARTIFACT_PATH }}
asset_content_type: application/zip