Skip to content

Commit ff17edc

Browse files
committed
extract tag
Signed-off-by: bakhtin <a@bakhtin.net>
1 parent 7b293ef commit ff17edc

File tree

2 files changed

+23
-163
lines changed

2 files changed

+23
-163
lines changed

.github/workflows/release-reproducible.yml

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,40 +16,38 @@ jobs:
1616
if: ${{ github.event.workflow_run.conclusion == 'success' }}
1717
runs-on: ubuntu-latest
1818
steps:
19-
- name: Extract version
20-
run: echo "VERSION=$(echo ${GITHUB_REF#refs/tags/})" >> $GITHUB_OUTPUT
19+
- name: Extract version from triggering tag
2120
id: extract_version
21+
env:
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
run: |
24+
# Get the tag that points to the head SHA of the triggering workflow
25+
TAG=$(gh api /repos/${{ github.repository }}/git/refs/tags \
26+
--jq '.[] | select(.object.sha == "${{ github.event.workflow_run.head_sha }}") | .ref' \
27+
| head -1 \
28+
| sed 's|refs/tags/||')
29+
30+
if [ -z "$TAG" ]; then
31+
echo "No tag found for SHA ${{ github.event.workflow_run.head_sha }}"
32+
exit 1
33+
fi
34+
35+
echo "VERSION=$TAG" >> $GITHUB_OUTPUT
36+
echo "Found tag: $TAG"
2237
outputs:
2338
VERSION: ${{ steps.extract_version.outputs.VERSION }}
2439

25-
wait-for-release:
26-
name: wait for main release workflow
27-
runs-on: ubuntu-latest
28-
needs: extract-version
29-
steps:
30-
- name: Wait for release workflow to complete
31-
uses: fountainhead/action-wait-for-check@v1.2.0
32-
id: wait-for-release
33-
with:
34-
token: ${{ secrets.GITHUB_TOKEN }}
35-
checkName: draft release
36-
ref: ${{ github.sha }}
37-
38-
- name: Check if release workflow succeeded
39-
if: steps.wait-for-release.outputs.conclusion != 'success'
40-
run: |
41-
echo "Release workflow failed or was cancelled"
42-
exit 1
43-
4440
build-reproducible:
4541
name: build and push reproducible image and binaries
4642
runs-on: warp-ubuntu-2404-x64-32x #TODO
47-
needs: [extract-version, wait-for-release]
43+
needs: [extract-version]
4844
permissions:
4945
packages: write
5046
contents: write
5147
steps:
5248
- uses: actions/checkout@v5
49+
with:
50+
ref: ${{ github.event.workflow_run.head_sha }}
5351

5452
- name: Set up Docker Buildx
5553
uses: docker/setup-buildx-action@v3

.github/workflows/release.yml

Lines changed: 3 additions & 141 deletions
Original file line numberDiff line numberDiff line change
@@ -43,122 +43,10 @@ jobs:
4343
outputs:
4444
VERSION: ${{ steps.extract_version.outputs.VERSION }}
4545

46-
check-version:
47-
name: check version
48-
runs-on: ubuntu-latest
49-
needs: extract-version
50-
if: ${{ github.event.inputs.dry_run != 'true' }}
51-
steps:
52-
- uses: actions/checkout@v5
53-
- uses: dtolnay/rust-toolchain@stable
54-
- name: Verify crate version matches tag
55-
# Check that the Cargo version starts with the tag,
56-
# so that Cargo version 1.4.8 can be matched against both v1.4.8 and v1.4.8-rc.1
57-
run: |
58-
tag="${{ needs.extract-version.outputs.VERSION }}"
59-
tag=${tag#v}
60-
cargo_ver=$(cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')
61-
[[ "$tag" == "$cargo_ver"* ]] || { echo "Tag $tag doesn’t match the Cargo version $cargo_ver"; exit 1; }
62-
63-
build:
64-
name: build release
65-
runs-on: ${{ matrix.configs.os }}
66-
needs: extract-version
67-
continue-on-error: ${{ matrix.configs.allow_fail }}
68-
strategy:
69-
fail-fast: true
70-
matrix:
71-
configs:
72-
- target: x86_64-unknown-linux-gnu
73-
os: warp-ubuntu-2404-x64-32x #TODO
74-
profile: maxperf
75-
allow_fail: false
76-
# - target: aarch64-unknown-linux-gnu
77-
# os: ubuntu-24.04
78-
# profile: maxperf
79-
# allow_fail: false
80-
# - target: x86_64-apple-darwin
81-
# os: macos-13
82-
# profile: maxperf
83-
# allow_fail: false
84-
# - target: aarch64-apple-darwin
85-
# os: macos-14
86-
# profile: maxperf
87-
# allow_fail: false
88-
# - target: x86_64-pc-windows-gnu
89-
# os: ubuntu-24.04
90-
# profile: maxperf
91-
# allow_fail: false
92-
# - target: riscv64gc-unknown-linux-gnu
93-
# os: ubuntu-24.04
94-
# profile: maxperf
95-
# allow_fail: true
96-
build:
97-
- command: build
98-
binary: reth
99-
- command: op-build
100-
binary: op-reth
101-
steps:
102-
- uses: actions/checkout@v5
103-
- uses: rui314/setup-mold@v1
104-
- uses: dtolnay/rust-toolchain@stable
105-
with:
106-
target: ${{ matrix.configs.target }}
107-
- name: Install cross main
108-
id: cross_main
109-
run: |
110-
cargo install cross --git https://github.com/cross-rs/cross
111-
- uses: Swatinem/rust-cache@v2
112-
with:
113-
cache-on-failure: true
114-
115-
- name: Apple M1 setup
116-
if: matrix.configs.target == 'aarch64-apple-darwin'
117-
run: |
118-
echo "SDKROOT=$(xcrun -sdk macosx --show-sdk-path)" >> $GITHUB_ENV
119-
echo "MACOSX_DEPLOYMENT_TARGET=$(xcrun -sdk macosx --show-sdk-platform-version)" >> $GITHUB_ENV
120-
121-
- name: Build Reth
122-
run: make PROFILE=${{ matrix.configs.profile }} ${{ matrix.build.command }}-${{ matrix.configs.target }}
123-
- name: Move binary
124-
run: |
125-
mkdir artifacts
126-
[[ "${{ matrix.configs.target }}" == *windows* ]] && ext=".exe"
127-
mv "target/${{ matrix.configs.target }}/${{ matrix.configs.profile }}/${{ matrix.build.binary }}${ext}" ./artifacts
128-
129-
- name: Configure GPG and create artifacts
130-
env:
131-
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
132-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
133-
run: |
134-
export GPG_TTY=$(tty)
135-
#echo -n "$GPG_SIGNING_KEY" | base64 --decode | gpg --batch --import
136-
#TODO
137-
echo -n "$GPG_SIGNING_KEY" | gpg --batch --import
138-
cd artifacts
139-
tar -czf ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}.tar.gz ${{ matrix.build.binary }}*
140-
echo "$GPG_PASSPHRASE" | gpg --passphrase-fd 0 --pinentry-mode loopback --batch -ab ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}.tar.gz
141-
mv *tar.gz* ..
142-
shell: bash
143-
144-
- name: Upload artifact
145-
if: ${{ github.event.inputs.dry_run != 'true' }}
146-
uses: actions/upload-artifact@v5
147-
with:
148-
name: ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}.tar.gz
149-
path: ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}.tar.gz
150-
151-
- name: Upload signature
152-
if: ${{ github.event.inputs.dry_run != 'true' }}
153-
uses: actions/upload-artifact@v5
154-
with:
155-
name: ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}.tar.gz.asc
156-
path: ${{ matrix.build.binary }}-${{ needs.extract-version.outputs.VERSION }}-${{ matrix.configs.target }}.tar.gz.asc
157-
15846
draft-release:
15947
name: draft release
16048
runs-on: ubuntu-latest
161-
needs: [build, extract-version]
49+
needs: [extract-version]
16250
if: ${{ github.event.inputs.dry_run != 'true' }}
16351
env:
16452
VERSION: ${{ needs.extract-version.outputs.VERSION }}
@@ -171,8 +59,6 @@ jobs:
17159
- uses: actions/checkout@v5
17260
with:
17361
fetch-depth: 0
174-
- name: Download artifacts
175-
uses: actions/download-artifact@v6
17662
- name: Generate full changelog
17763
id: changelog
17864
run: |
@@ -260,31 +146,7 @@ jobs:
260146
| <img src="https://www.svgrepo.com/download/473589/docker.svg" width="50"/> | Docker | [${{ env.OP_IMAGE_NAME }}](${{ env.DOCKER_OP_IMAGE_NAME_URL }}) | - |
261147
ENDBODY
262148
)
263-
assets=()
264-
for asset in ./*reth-*.tar.gz*; do
265-
assets+=("$asset/$asset")
266-
done
149+
267150
tag_name="${{ env.VERSION }}"
268-
echo "$body" | gh release create --draft $prerelease_flag -t "Reth $tag_name" -F "-" "$tag_name" "${assets[@]}"
151+
echo "$body" | gh release create --draft $prerelease_flag -t "Reth $tag_name" -F "-" "$tag_name"
269152
270-
dry-run-summary:
271-
name: dry run summary
272-
runs-on: ubuntu-latest
273-
needs: [build, extract-version]
274-
if: ${{ github.event.inputs.dry_run == 'true' }}
275-
env:
276-
VERSION: ${{ needs.extract-version.outputs.VERSION }}
277-
steps:
278-
- name: Summarize dry run
279-
run: |
280-
echo "## 🧪 Release Dry Run Summary"
281-
echo ""
282-
echo "✅ Successfully completed dry run for commit ${{ github.sha }}"
283-
echo ""
284-
echo "### What would happen in a real release:"
285-
echo "- Binary artifacts would be uploaded to GitHub"
286-
echo "- Docker images would be pushed to registry"
287-
echo "- A draft release would be created"
288-
echo ""
289-
echo "### Next Steps"
290-
echo "To perform a real release, push a git tag."

0 commit comments

Comments
 (0)