Skip to content

Commit

Permalink
Build docker images for ICS
Browse files Browse the repository at this point in the history
  • Loading branch information
fastfadingviolets committed Jun 3, 2024
1 parent 173a5d6 commit a8f374c
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 40 deletions.
54 changes: 54 additions & 0 deletions .github/actions/build-ics-binary/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "Build ICS Binary"
description: "Builds the ICS binary from a release and uploads it as an artifact."
inputs:
release:
description: "The release to build the ICS binary from."
required: true
github_token:
description: "The GitHub token."
required: true
runs:
using: "composite"
steps:
- name: Install tools
shell: bash
run: |
sudo apt-get install curl jq -y
- name: Setup environment
shell: bash
run: |
sudo apt install build-essential wget -y
- name: Install golang
shell: bash
run: |
wget -q https://go.dev/dl/go1.20.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
- name: Clone and build interchain security
shell: bash
run: |
export PATH=$PATH:/usr/local/go/bin
RELEASE=${{ inputs.release }}
git clone https://github.com/cosmos/interchain-security.git
cd interchain-security
git checkout $RELEASE
export LDFLAGS="-extldflags=-static"
export CGO_ENABLED=0
make install
cp ~/go/bin/interchain-security-cd ~/interchain-security-cd-linux
cp ~/go/bin/interchain-security-pd ~/interchain-security-pd-linux
# Publish
- name: Add release
uses: ncipollo/release-action@v1
with:
artifacts: "~/interchain-security-cd-linux,~/interchain-security-pd-linux"
name: ics-${{ inputs.release }}
bodyFile: .github/workflows/ics-linux-release-body.md
prerelease: true
replacesArtifacts: false
allowUpdates: false
tag: "ics-${{ inputs.release }}"
token: ${{ inputs.github_token }}
2 changes: 1 addition & 1 deletion .github/workflows/gaiad-linux-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
uses: rafalkk/remove-dockertag-action@v1
continue-on-error: true
with:
tag_name: main
tag_name: hyphacoop/gaia:main
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: strangelove-ventures/[email protected]
Expand Down
75 changes: 36 additions & 39 deletions .github/workflows/ics-linux-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,58 +8,55 @@ jobs:
name: Read latest interchain-security release
runs-on: ubuntu-latest
outputs:
release: ${{ steps.query_release.outputs.release }}
releases: ${{ steps.query_release.outputs.releases }}
steps:
- name: Query latest release of the interchain-security repo
id: query_release
run: |
latest=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/cosmos/interchain-security/releases | jq -r '.[0].tag_name')
echo "release=$latest" >> "$GITHUB_OUTPUT"
releases=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/cosmos/interchain-security/releases | jq -c '[.[].tag_name]')
echo "releases=$releases" >> "$GITHUB_OUTPUT"
build:
name: Build
runs-on: ubuntu-latest
needs: [collect_remote_release]
permissions:
contents: write
strategy:
matrix:
release: ${{fromJson(needs.collect_remote_release.outputs.releases)}}
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Build and release
uses: ./.github/actions/build-ics-binary
with:
release: ${{ matrix.release }}
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Install tools
run: |
sudo apt-get install curl jq -y
- name: Setup environment
run: |
sudo apt install build-essential wget -y
- name: Install golang
run: |
wget -q https://go.dev/dl/go1.20.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
- name: Clone and build interchain security
run: |
export PATH=$PATH:/usr/local/go/bin
LAST_RELEASE=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/cosmos/interchain-security/releases | jq -r '.[0].tag_name')
git clone https://github.com/cosmos/interchain-security.git
cd interchain-security
git checkout $LAST_RELEASE
export LDFLAGS="-extldflags=-static"
export CGO_ENABLED=0
make install
cp ~/go/bin/interchain-security-cd ~/interchain-security-cd-linux
# Publish
- name: Add release
uses: ncipollo/release-action@v1
build-docker:
name: Build Docker image
runs-on: ubuntu-latest
needs: [collect_remote_release]
permissions: write-all
strategy:
matrix:
release: ${{fromJson(needs.collect_remote_release.outputs.releases)}}
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: strangelove-ventures/[email protected]
with:
artifacts: "~/interchain-security-cd-linux"
name: consumer-${{needs.collect_remote_release.outputs.release}}
bodyFile: .github/workflows/ics-linux-release-body.md
prerelease: true
replacesArtifacts: false
allowUpdates: false
tag: "ics-consumer-${{needs.collect_remote_release.outputs.release}}"
token: ${{ secrets.GITHUB_TOKEN }}
chain: ics
tag: ${{ matrix.release }}
git-ref: ${{ matrix.release }}
github-organization: cosmos
github-repo: interchain-security
additional-args: "--go-version=1.21.10"

0 comments on commit a8f374c

Please sign in to comment.