diff --git a/.github/actions/build-ics-binary/action.yml b/.github/actions/build-ics-binary/action.yml new file mode 100644 index 0000000..b699c3e --- /dev/null +++ b/.github/actions/build-ics-binary/action.yml @@ -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 }} diff --git a/.github/workflows/gaiad-linux-main.yml b/.github/workflows/gaiad-linux-main.yml index b569b4f..e19d66b 100644 --- a/.github/workflows/gaiad-linux-main.yml +++ b/.github/workflows/gaiad-linux-main.yml @@ -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/heighliner-build-action@v1.0.2 diff --git a/.github/workflows/ics-linux-release.yml b/.github/workflows/ics-linux-release.yml index ceb59e5..cd178a7 100644 --- a/.github/workflows/ics-linux-release.yml +++ b/.github/workflows/ics-linux-release.yml @@ -8,13 +8,13 @@ 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 @@ -22,44 +22,41 @@ jobs: 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/heighliner-build-action@v1.0.2 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" \ No newline at end of file