Skip to content

Commit

Permalink
cURL install script automation. (#39)
Browse files Browse the repository at this point in the history
* init commit

* CI: test

* CI: test #2

* CI: test 4

* CI: fix

* CI: update

* update INSTALL docs

* CI: update
  • Loading branch information
tarassh authored Sep 30, 2024
1 parent d98b1fe commit e5b9ee4
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 410 deletions.
79 changes: 79 additions & 0 deletions .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: Build and Release - macOS

on:
push:
branches: [ main ]
tags: [ v*.*.* ] # Trigger on tag pushes for releases
pull_request:
branches: [ main ]

jobs:
build-macos:
runs-on: macos-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Install dependencies
run: make deps

- name: Run go fmt
run: make fmt

- name: Run go vet
run: make vet

- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run tests
run: make test

- name: Build binaries
run: make build

- name: Collect light client artifacts
run: |
mkdir -p das-macos
cp bin/light-client das-macos/
cp scripts/macos/* das-macos/
cp test/data/trusted_setup.txt das-macos/
- name: Install Google Cloud SDK
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: brew install --cask google-cloud-sdk

- name: Authenticate with Google Cloud
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_SA_KEY }}
run: |
cat <<EOF > gcp-key.json
${{ secrets.GCP_SA_KEY }}
EOF
gcloud auth activate-service-account --key-file=gcp-key.json
- name: Update `install.sh` with version number
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
VERSION=${GITHUB_REF##*/}
sed -i.bak "s/{{VERSION}}/${VERSION}/g" scripts/macos/install.sh
- name: Upload to Google Cloud Storage
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
run: |
VERSION=${GITHUB_REF##*/}
GCS_BUCKET_PATH_BIN="gs://ewm-release-artefacts/${VERSION}/macos/light-client"
GCS_BUCKET_PATH_SETUP="gs://ewm-release-artefacts/${VERSION}/macos/trusted_setup.txt"
GCS_BUCKET_PATH_INSTALL="gs://ewm-release-artefacts/${VERSION}/macos/install.sh"
gsutil cp -a public-read bin/light-client $GCS_BUCKET_PATH_BIN
gsutil cp -a public-read test/data/trusted_setup.txt $GCS_BUCKET_PATH_SETUP
gsutil cp -a public-read scripts/macos/install.sh $GCS_BUCKET_PATH_INSTALL
82 changes: 82 additions & 0 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: Build and Release - Ubuntu

on:
push:
branches: [ main ]
tags: [ v*.*.* ] # Trigger on tag pushes for releases
pull_request:
branches: [ main ]

jobs:
build-ubuntu:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.22'

- name: Install dependencies
run: make deps

- name: Run go fmt
run: make fmt

- name: Run go vet
run: make vet

- name: Run staticcheck
run: |
go install honnef.co/go/tools/cmd/staticcheck@latest
staticcheck ./...
- name: Run tests
run: make test

- name: Build binaries
run: make build

- name: Collect light client artifacts
run: |
mkdir -p das-ubuntu
cp bin/light-client das-ubuntu/
- name: Create tarball
run: |
TAG=${GITHUB_REF##*/} # Extracts the tag from GITHUB_REF (e.g., refs/tags/v1.0.0 -> v1.0.0)
tar -czvf das-ubuntu-${TAG}.tar.gz -C das-ubuntu .
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: das-ubuntu-${{ github.ref_name }} # Use the tag name for the artifact
path: das-ubuntu-${{ github.ref_name }}.tar.gz

release-ubuntu:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')

needs: build-ubuntu
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Download Ubuntu artifacts
uses: actions/download-artifact@v4
with:
name: das-ubuntu-${{ github.ref_name }}
path: .

- name: Upload release asset
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
draft: false
prerelease: false
files: |
das-ubuntu-${{ github.ref_name }}.tar.gz
103 changes: 0 additions & 103 deletions .github/workflows/go.yml

This file was deleted.

2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ipfs init
Single command to install and launch the Light Client:

```bash
curl -sSf https://storage.googleapis.com/ewm-release-artefacts/v0.9.0/macos/installv2.sh | bash -s <YOUR PRIVATE KEY>
curl -sSf https://storage.googleapis.com/ewm-release-artefacts/{{VERSION}}/macos/install.sh | bash -s <YOUR PRIVATE KEY>
```

Or go to the [Light Client Releases](https://github.com/covalenthq/ewm-das/releases) page and download the latest release.
Expand Down
Loading

0 comments on commit e5b9ee4

Please sign in to comment.