Skip to content

Commit

Permalink
Workflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
sarunasrakauskas committed May 30, 2024
1 parent c80a6e5 commit 29164c4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then
GOOS=linux GOARCH=amd64 go build -o smeditor
zip -r release/smeditor-linux-${{ matrix.go-version }}.zip smeditor
tar -czvf release/smeditor-linux-${{ matrix.go-version }}.tar.gz smeditor
else
GOOS=darwin GOARCH=amd64 go build -o smeditor
zip -r release/smeditor-macos-${{ matrix.go-version }}.zip smeditor
tar -czvf release/smeditor-macos-${{ matrix.go-version }}.tar.gz smeditor
fi
- name: Upload release assets
Expand All @@ -64,7 +64,9 @@ jobs:
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: release/smeditor-*
files: |
release/smeditor-*
install.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Expand Down
37 changes: 37 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh

# Determine the OS
OS="$(uname -s)"
case "$OS" in
Linux*) OS=linux;;
Darwin*) OS=macos;;
*) echo "Unsupported OS: $OS"; exit 1;;
esac

# Determine the latest version tag from GitHub and find the corresponding asset URL
ASSET_URL=$(curl -s https://api.github.com/repos/coingate/smeditor/releases/latest | grep "browser_download_url.*${OS}.*tar.gz" | cut -d '"' -f 4)

# Check if the ASSET_URL was found
if [ -z "$ASSET_URL" ]; then
echo "Failed to find the download URL for the latest release."
exit 1
fi

# Download the appropriate tar.gz file
curl -L -o smeditor.tar.gz "$ASSET_URL"

# Extract the downloaded file
tar -xzf smeditor.tar.gz -C smeditor --strip-components=1

# Move the binary to /usr/local/bin
sudo mv smeditor/smeditor /usr/local/bin/

# Clean up
rm -rf smeditor.tar.gz smeditor

# Verify installation
if command -v smeditor > /dev/null; then
echo "smeditor installed successfully!"
else
echo "Installation failed."
fi

0 comments on commit 29164c4

Please sign in to comment.