Gaia Linux Build v10 Release #629
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Gaia Linux Build v10 Release | |
on: | |
workflow_dispatch: | |
schedule: | |
# Run four times a day, M-F | |
- cron: '5 4,10,16,22 * * 1-5' | |
jobs: | |
collect_remote_commit: | |
name: Read latest release branch commit | |
runs-on: ubuntu-latest | |
outputs: | |
sha: ${{ steps.query_commit.outputs.sha }} | |
steps: | |
- name: Query latest commit on the release/v10.0.x branch | |
id: query_commit | |
run: | | |
commit=$(curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/cosmos/gaia/branches/release/v10.0.x | jq -r '.commit.sha') | |
echo "sha=$commit" >> "$GITHUB_OUTPUT" | |
collect_latest_build: | |
name: Read latest release from build repo | |
runs-on: ubuntu-latest | |
outputs: | |
sha: ${{ steps.query_release.outputs.sha }} | |
steps: | |
- name: Query latest release | |
id: query_release | |
run: | | |
curl -s -L -H "Accept: application/vnd.github+json" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/hyphacoop/cosmos-builds/releases > releases.json | |
release=$(jq -r '.[] | select(.tag_name== "gaiad-linux-release-v10") | .name' releases.json) | |
echo "sha=$release" >> "$GITHUB_OUTPUT" | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
needs: [collect_remote_commit, collect_latest_build] | |
if: needs.collect_remote_commit.outputs.sha != needs.collect_latest_build.outputs.sha | |
permissions: | |
contents: write | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
- 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: Update PATH | |
run: | | |
echo "/usr/local/go/bin" >> $GITHUB_PATH | |
- name: Clone and build Gaia | |
run: | | |
git clone https://github.com/cosmos/gaia.git | |
cd gaia | |
git checkout release/v10.0.x | |
export LDFLAGS="-extldflags=-static" | |
make build | |
cp build/gaiad ~/gaiad-linux | |
- name: Print gaia version | |
run: | | |
~/gaiad-linux version | |
# Publish | |
- name: Remove old releases | |
uses: dev-drprasad/[email protected] | |
with: | |
keep_latest: 0 | |
delete_tag_pattern: "gaiad-linux-release-v10" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Add release | |
uses: ncipollo/release-action@v1 | |
with: | |
artifacts: "~/gaiad-linux" | |
name: ${{needs.collect_remote_commit.outputs.sha}} | |
bodyFile: .github/workflows/gaiad-linux-release-v10-body.md | |
prerelease: true | |
replacesArtifacts: false | |
allowUpdates: false | |
tag: "gaiad-linux-release-v10" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
# Trigger cosmos-ansible workflows | |
- name: Dispatch to cosmos-ansible repo | |
env: | |
SECRET_TOKEN: ${{ secrets.HYPHA_BOT_ACTIONS_TOKEN }} | |
run: | | |
curl -L \ | |
-X POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer $SECRET_TOKEN" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
https://api.github.com/repos/hyphacoop/cosmos-ansible/dispatches \ | |
-d '{"event_type":"new_v10_build","client_payload":{}}' | |