Skip to content

Commit

Permalink
Fix binaries artifact names when built on tags (#1569)
Browse files Browse the repository at this point in the history
Our `binaries` workflow builds artifacts for linux and macos of our main
executables.

On tags, it should produce artifacts named
`hydra-<arch>-<os>-<version>.zip` or otherwise the tutorial instructions
do not work. Also, we would like to have clean artifacts to be included
in release notes.

### Problem

For some reason the `git describe` was reporting a version x commits
ahead of the previous release, instead of just the name of the latest
tag.

### Solution

:detective: Fixes version determination by refetching tags before
calling `git describe`.

:detective: Runs binaries workflow not on every push, but only on PRs,
important branches and obviously tags.

Fixed workflow on a temporary `0.0.0-test` tag:
https://github.com/cardano-scaling/hydra/actions/runs/10417337202

---

* [x] CHANGELOG update not needed
* [x] Documentation update not needed
* [x] Haddocks update not needed
* [x] No new TODOs introduced
  • Loading branch information
ch1bo authored Aug 16, 2024
2 parents 6a37a2c + f5e2a67 commit b230fa8
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ name: Binaries
on:
push:
branches:
- "**"
- main
- release
tags:
- "*.*.*"
pull_request:

jobs:
# Produces static ELF binary for using MuslC which includes all needed
Expand Down Expand Up @@ -34,11 +36,17 @@ jobs:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: 🕵 Determine version
run: |
# NOTE: For some reason the fetched tags on checkout are not effective
# and we need to refetch with --force for git describe.
git fetch --tags --force
echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV"
- name: ❄ Build static executables
run: |
nix build .#release-static
# XXX: Why unzip https://github.com/actions/upload-artifact/issues/39
echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV"
unzip result/*.zip -d out
- name: 💾 Upload executables
Expand Down Expand Up @@ -72,11 +80,17 @@ jobs:
name: cardano-scaling
authToken: '${{ secrets.CACHIX_CARDANO_SCALING_AUTH_TOKEN }}'

- name: 🕵 Determine version
run: |
# NOTE: For some reason the fetched tags on checkout are not effective
# and we need to refetch with --force for git describe.
git fetch --tags --force
echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV"
- name: ❄ Build executables
run: |
nix build .#release
# XXX: Why unzip https://github.com/actions/upload-artifact/issues/39
echo "VERSION=$(git describe --always ${{ github.ref }})" >> "$GITHUB_ENV"
unzip result/*.zip -d out
- name: 💾 Upload executables
Expand Down

0 comments on commit b230fa8

Please sign in to comment.