1
1
mirror of https://github.com/Yvee1/hascard.git synced 2024-11-22 04:33:06 +03:00

Add Windows to GitHub workflow

This commit is contained in:
Yvee1 2023-12-17 15:04:51 +01:00
parent 7f4a0ae967
commit 98248a81ee
4 changed files with 54 additions and 11 deletions

View File

@ -8,19 +8,36 @@ else
if [ "$RUNNER_OS" = "Linux" ]
then
ARCH="linux"
elif [ "$RUNNER_OS" = "Windows" ]
then
ARCH="windows"
else
ARCH="osx"
fi
OWNER="$(echo "$GITHUB_REPOSITORY" | cut -f1 -d/)"
REPO="$(echo "$GITHUB_REPOSITORY" | cut -f2 -d/)"
BIN="$(stack path --local-install-root)/bin/$REPO"
BUNDLE_NAME="$REPO-$RELEASE_VERSION-$ARCH.tar.gz"
cp "$BIN" "./$REPO"
chmod +x "./$REPO"
tar -czf "$BUNDLE_NAME" "$REPO"
echo "SHA256:"
shasum -a 256 "$BUNDLE_NAME"
ls $HOME/.local/bin/
echo $PATH
$HOME/.local/bin/ghr -t "$GITHUB_TOKEN" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
if [ "$RUNNER_OS" = "Windows" ]
then
BIN="$(stack path --local-install-root)/bin/$REPO.exe"
cp "$BIN" "./$REPO.exe"
chmod +x "./$REPO.exe"
BUNDLE_NAME="$REPO-$RELEASE_VERSION-$ARCH.zip"
zip "$BUNDLE_NAME" "$REPO.exe"
echo "SHA256:"
shasum -a 256 "$BUNDLE_NAME"
ls $HOME/ghr/
echo $PATH
ghr -t "$GITHUB_TOKEN" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
else
BIN="$(stack path --local-install-root)/bin/$REPO"
BUNDLE_NAME="$REPO-$RELEASE_VERSION-$ARCH.tar.gz"
cp "$BIN" "./$REPO"
chmod +x "./$REPO"
tar -czf "$BUNDLE_NAME" "$REPO"
echo "SHA256:"
shasum -a 256 "$BUNDLE_NAME"
ls $HOME/.local/bin/
echo $PATH
$HOME/.local/bin/ghr -t "$GITHUB_TOKEN" -u "$OWNER" -r "$REPO" --replace "$(git describe --tags)" "$BUNDLE_NAME"
fi
fi

View File

@ -15,6 +15,18 @@ else
tar -x -f ghr.tar --strip-components 1
mv ghr "$HOME/.local/bin/"
rm ghr.tar
elif [ "$RUNNER_OS" = "Windows"]
then
ARCH="windows"
URL="https://github.com/tcnksm/ghr/releases/download/v0.14.0/ghr_v0.14.0_${ARCH}_amd64.zip"
curl -L ${URL} > ghr.zip
unzip ghr.zip
GHR_DIR="ghr_v0.14.0_${ARCH}_amd64"
mkdir "$HOME/ghr"
mv $GHR_DIR/ghr.exe "$HOME/ghr"
export PATH=$PATH:"$HOME/ghr"
rm ghr.zip
rm -r $GHR_DIR
else
ARCH="darwin"
URL="https://github.com/tcnksm/ghr/releases/download/v0.14.0/ghr_v0.14.0_${ARCH}_amd64.zip"

View File

@ -8,6 +8,9 @@ else
if [ "$RUNNER_OS" = "Linux" ]
then
ARCH="linux"
elif [ "$RUNNER_OS" = "Windows" ]
then
ARCH="windows"
else
ARCH="osx"
fi
@ -16,7 +19,14 @@ else
gunzip stack.tar.gz
tar -x -f stack.tar --strip-components 1
mkdir -p "$HOME/.local/bin"
mv stack "$HOME/.local/bin/"
if [ "$RUNNER_OS" = "Windows" ]
then
mkdir "$HOME/stack"
mv stack.exe "$HOME/stack"
export PATH=$PATH:"$HOME/stack"
else
mv stack "$HOME/.local/bin/"
fi
rm stack.tar
fi

View File

@ -3,12 +3,16 @@ on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2