Skip to content

Commit

Permalink
fix: release artifact names and tags (#866)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbaztec authored Jan 24, 2025
1 parent a2e7e93 commit b993907
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/release-please.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ jobs:
uses: ./.github/workflows/release.yml
with:
tag: ${{ needs.release-please.outputs.tag_name }}
version: ${{ (needs.release-please.outputs.tag_name && format('{0}.{1}.{2}', needs.release-please.outputs.major, needs.release-please.outputs.minor, needs.release-please.outputs.patch)) || ''}}
secrets: inherit
48 changes: 35 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ on:
workflow_call:
inputs:
tag:
description: "Tag to use for the release."
description: "Tag to use for the release (<component>-v<version>)."
type: string
required: true
default: ""
version:
description: "Version for the release."
type: string
required: true
default: ""
Expand All @@ -24,6 +29,7 @@ jobs:
timeout-minutes: 30
outputs:
tag_name: ${{ steps.release_info.outputs.tag_name }}
version_name: ${{ steps.release_info.outputs.version_name }}
release_name: ${{ steps.release_info.outputs.release_name }}
prerelease: ${{ steps.release_info.outputs.prerelease }}
changelog: ${{ steps.build_changelog.outputs.changelog || '' }}
Expand All @@ -36,21 +42,37 @@ jobs:
- name: Compute release name and tag
id: release_info
run: |
if [[ $IS_NIGHTLY ]]; then
echo "tag_name=nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT
echo "nightly: $IS_NIGHTLY"
if [ $IS_NIGHTLY == "true" ]; then
TAG="${{ inputs.tag || format('nightly-{0}', github.sha) }}"
VERSION="${{ inputs.version || 'nightly' }}"
echo "tag_name=${TAG}" >> $GITHUB_OUTPUT
echo "version_name=${VERSION}" >> $GITHUB_OUTPUT
echo "release_name=foundry-zksync Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT
echo "prerelease=true" >> $GITHUB_OUTPUT
else
echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
echo "release_name=foundry-zksync@${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
TAG="${{ inputs.tag || format('stable-{0}', github.sha) }}"
VERSION="${{ inputs.version || 'stable' }}"
echo "tag_name=${TAG}" >> $GITHUB_OUTPUT
echo "version_name=v${VERSION}" >> $GITHUB_OUTPUT
echo "release_name=foundry-zksync v${VERSION}" >> $GITHUB_OUTPUT
echo "prerelease=false" >> $GITHUB_OUTPUT
fi
- name: Print release info
run: |
echo tag_name: "${{ steps.release_info.outputs.tag_name }}"
echo version_name: "${{ steps.release_info.outputs.version_name }}"
echo release_name: "${{ steps.release_info.outputs.release_name }}"
echo prerelease: "${{ steps.release_info.outputs.prerelease }}"
# Creates a `nightly-SHA` tag for this specific nightly
# This tag is used for this specific nightly version's release
# which allows users to roll back. It is also used to build
# the changelog.
- name: Create build-specific nightly tag
- name: Create build-specific tag (nightly)
if: ${{ env.IS_NIGHTLY == 'true' }}
uses: actions/github-script@v7
env:
Expand All @@ -60,7 +82,7 @@ jobs:
const createTag = require('./.github/scripts/create-tag.js')
await createTag({ github, context }, process.env.TAG_NAME)
- name: Build changelog
- name: Build changelog (nightly)
if: ${{ env.IS_NIGHTLY == 'true' }}
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v4
Expand Down Expand Up @@ -163,17 +185,17 @@ jobs:
PLATFORM_NAME: ${{ matrix.platform }}
TARGET: ${{ matrix.target }}
ARCH: ${{ matrix.arch }}
VERSION_NAME: ${{ (env.IS_NIGHTLY && 'nightly') || needs.prepare.outputs.tag_name }}
VERSION_NAME: ${{ needs.prepare.outputs.version_name }}
shell: bash
run: |
if [ "$PLATFORM_NAME" == "linux" ]; then
tar -czvf "foundry_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast
echo "file_name=foundry_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
tar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast
echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
elif [ "$PLATFORM_NAME" == "darwin" ]; then
# We need to use gtar here otherwise the archive is corrupt.
# See: https://github.com/actions/virtual-environments/issues/2619
gtar -czvf "foundry_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast
echo "file_name=foundry_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
gtar -czvf "foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" -C ./target/${TARGET}/release forge cast
echo "file_name=foundry_zksync_${VERSION_NAME}_${PLATFORM_NAME}_${ARCH}.tar.gz" >> $GITHUB_OUTPUT
fi
- name: Build man page
Expand All @@ -182,7 +204,7 @@ jobs:
env:
PLATFORM_NAME: ${{ matrix.platform }}
TARGET: ${{ matrix.target }}
VERSION_NAME: ${{ (env.IS_NIGHTLY == 'true' && 'nightly') || needs.prepare.outputs.tag_name }}
VERSION_NAME: ${{ needs.prepare.outputs.version_name }}
shell: bash
run: |
sudo apt-get -y install help2man
Expand Down

0 comments on commit b993907

Please sign in to comment.