Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release workflow #16

Merged
merged 12 commits into from
Feb 7, 2025
119 changes: 119 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: release-relayer

on:
workflow_dispatch:
inputs:
runtime_version:
type: string
description: Latest runtime version compatible with
snowbridge_version:
type: string
description: Linked snowbridge version

jobs:
release-relayer:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'true'
fetch-tags: 'true'

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "14"

- name: Setup go
uses: actions/checkout@v4
with:
go-version: "^1.21.0"

- name: Install Go tools
run: >
go install github.com/magefile/mage@v1.15.0 &&
go install github.com/ferranbt/fastssz/sszgen@v0.1.3 &&
go install github.com/ethereum/go-ethereum/cmd/abigen@v1.14.8

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1

- name: Install dependencies
run: go mod download

- name: Add gopath to bin
run: echo "$HOME/go/bin" >> $GITHUB_PATH

- name: Build
run: CGO_ENABLED=1 GOOS=linux GOARCH=amd64 mage build

- name: Configure Git
run: |
git config --global user.name 'github-actions'
git config --global user.email 'github-actions@github.com'

- name: Determine new version
id: new_version
run: |
# Get the most recent tag in the format relayer-v<version>
current_tag=$(git tag --list "relayer-v*" --sort=-v:refname | head -n 1)
new_tag="relayer-v${{ inputs.snowbridge_version }}-${{ inputs.runtime_version }}"

echo "Old tag: $current_tag"
echo "New tag: $new_tag"
echo "new_tag=$new_tag" >> $GITHUB_OUTPUT
echo "from_tag=$current_tag" >> $GITHUB_OUTPUT

- name: Create new tag
id: create_tag
run: |
tag_name="${{ steps.new_version.outputs.new_tag }}"
echo "Tag name: $tag_name"
echo "tag=$tag_name" >> $GITHUB_OUTPUT
git tag $tag_name

- name: Push new tag
run: |
git push origin --tags

- name: "Build Changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
with:
configurationJson: |
{
"template": "#{{CHANGELOG}}",
"categories": [
{
"title": "## Relayer Changes",
"labels": []
}
]
}
fromTag: ${{ steps.new_version.outputs.from_tag }}
toTag: ${{ steps.create_tag.outputs.tag }}

- name: Create a GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.tag }}
release_name: ${{ steps.create_tag.outputs.tag }}
body: |
${{steps.build_changelog.outputs.changelog}}
draft: true
prerelease: false

- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/tanssi-bridge-relayer
asset_name: tanssi-bridge-relayer
asset_content_type: application/octet-stream
Loading