|
| 1 | +name: Tesseract Admin Relayer Docker Publish |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "tesseract-admin-relayer-v[0-9]+.[0-9]+.[0-9]+" |
| 7 | + |
| 8 | +concurrency: |
| 9 | + group: release-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
| 12 | +jobs: |
| 13 | + build_and_publish: |
| 14 | + runs-on: release-runner |
| 15 | + permissions: |
| 16 | + contents: read |
| 17 | + packages: write |
| 18 | + steps: |
| 19 | + - name: Checkout sources |
| 20 | + uses: actions/checkout@v3 |
| 21 | + with: |
| 22 | + token: ${{ secrets.GH_TOKEN }} |
| 23 | + submodules: recursive |
| 24 | + |
| 25 | + - uses: webfactory/ssh-agent@v0.5.4 |
| 26 | + with: |
| 27 | + ssh-private-key: "${{ secrets.SSH_KEY }}" |
| 28 | + |
| 29 | + - name: Install toolchain |
| 30 | + uses: dtolnay/rust-toolchain@nightly |
| 31 | + with: |
| 32 | + toolchain: stable |
| 33 | + |
| 34 | + - uses: pnpm/action-setup@v4 |
| 35 | + with: |
| 36 | + version: 10 |
| 37 | + |
| 38 | + - name: Set up Node |
| 39 | + uses: actions/setup-node@v3 |
| 40 | + with: |
| 41 | + node-version: 22 |
| 42 | + cache-dependency-path: "evm/pnpm-lock.yaml" |
| 43 | + cache: "pnpm" |
| 44 | + |
| 45 | + - name: Install npm dependencies |
| 46 | + working-directory: evm |
| 47 | + run: | |
| 48 | + pnpm install |
| 49 | +
|
| 50 | + - name: Install Foundry |
| 51 | + uses: foundry-rs/foundry-toolchain@v1 |
| 52 | + with: |
| 53 | + version: nightly |
| 54 | + |
| 55 | + - name: Build Foundry artifacts |
| 56 | + working-directory: evm |
| 57 | + run: forge build |
| 58 | + |
| 59 | + - name: Build |
| 60 | + run: | |
| 61 | + sudo apt-get update -y |
| 62 | + sudo apt-get install -y clang netcat wget curl libssl-dev llvm libudev-dev make protobuf-compiler pkg-config |
| 63 | + cargo build --release -p tesseract-admin-relayer |
| 64 | + - name: Install cargo-get |
| 65 | + run: cargo install cargo-get |
| 66 | + |
| 67 | + - name: Resolve version |
| 68 | + id: version |
| 69 | + run: | |
| 70 | + VERSION=$(cargo get package.version --entry ./tesseract/consensus/admin-relayer) |
| 71 | + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" |
| 72 | +
|
| 73 | + - name: Login to Docker Hub |
| 74 | + uses: docker/login-action@v3 |
| 75 | + with: |
| 76 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 77 | + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} |
| 78 | + |
| 79 | + - name: Login to GitHub Container Registry |
| 80 | + uses: docker/login-action@v3 |
| 81 | + with: |
| 82 | + registry: ghcr.io |
| 83 | + username: ${{ github.actor }} |
| 84 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + |
| 86 | + - name: Set up Docker Buildx |
| 87 | + uses: docker/setup-buildx-action@v3 |
| 88 | + |
| 89 | + - name: Build and push Docker image |
| 90 | + uses: docker/build-push-action@v6 |
| 91 | + with: |
| 92 | + context: . |
| 93 | + file: ./scripts/docker/admin-relayer.Dockerfile |
| 94 | + push: true |
| 95 | + tags: | |
| 96 | + polytopelabs/tesseract-admin-relayer:v${{ steps.version.outputs.version }} |
| 97 | + polytopelabs/tesseract-admin-relayer:latest |
| 98 | + ghcr.io/${{ github.repository_owner }}/tesseract-admin-relayer:v${{ steps.version.outputs.version }} |
| 99 | + ghcr.io/${{ github.repository_owner }}/tesseract-admin-relayer:latest |
| 100 | +
|
| 101 | + generate-changelog: |
| 102 | + runs-on: ubuntu-latest |
| 103 | + needs: build_and_publish |
| 104 | + permissions: |
| 105 | + contents: write |
| 106 | + steps: |
| 107 | + - name: Checkout repository |
| 108 | + uses: actions/checkout@v4 |
| 109 | + with: |
| 110 | + fetch-depth: 0 |
| 111 | + |
| 112 | + - name: Get previous tag |
| 113 | + id: previous-tag |
| 114 | + run: | |
| 115 | + CURRENT_TAG=${GITHUB_REF#refs/tags/} |
| 116 | + PREVIOUS_TAG=$(git tag -l "tesseract-admin-relayer-v*" --sort=-version:refname | grep -v "^${CURRENT_TAG}$" | head -n1) |
| 117 | + echo "previous_tag=${PREVIOUS_TAG}" >> $GITHUB_OUTPUT |
| 118 | + echo "current_tag=${CURRENT_TAG}" >> $GITHUB_OUTPUT |
| 119 | + echo "clean_tag=${CURRENT_TAG#tesseract-admin-relayer-}" >> $GITHUB_OUTPUT |
| 120 | +
|
| 121 | + - name: Generate changelog |
| 122 | + id: changelog |
| 123 | + run: | |
| 124 | + CURRENT_TAG=${{ steps.previous-tag.outputs.current_tag }} |
| 125 | + PREVIOUS_TAG=${{ steps.previous-tag.outputs.previous_tag }} |
| 126 | +
|
| 127 | + echo "Generating changelog for ${CURRENT_TAG}" |
| 128 | + echo "Previous tag: ${PREVIOUS_TAG}" |
| 129 | +
|
| 130 | + if [ -z "$PREVIOUS_TAG" ]; then |
| 131 | + COMMIT_RANGE="HEAD" |
| 132 | + else |
| 133 | + COMMIT_RANGE="${PREVIOUS_TAG}..${CURRENT_TAG}" |
| 134 | + fi |
| 135 | +
|
| 136 | + CHANGELOG=$(git log --pretty=format:"* %s (%h)" $COMMIT_RANGE --reverse | grep -iE "admin-relayer|admin relayer" || true) |
| 137 | +
|
| 138 | + echo "changelog<<EOF" >> $GITHUB_OUTPUT |
| 139 | + echo "## What's Changed" >> $GITHUB_OUTPUT |
| 140 | + echo "" >> $GITHUB_OUTPUT |
| 141 | + echo "$CHANGELOG" >> $GITHUB_OUTPUT |
| 142 | + echo "EOF" >> $GITHUB_OUTPUT |
| 143 | +
|
| 144 | + - name: Create GitHub Release |
| 145 | + uses: actions/create-release@v1 |
| 146 | + env: |
| 147 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 148 | + with: |
| 149 | + tag_name: ${{ steps.previous-tag.outputs.current_tag }} |
| 150 | + release_name: "Tesseract Admin Relayer ${{ steps.previous-tag.outputs.clean_tag }}" |
| 151 | + body: ${{ steps.changelog.outputs.changelog }} |
| 152 | + draft: false |
| 153 | + prerelease: false |
0 commit comments