Skip to content

Commit b6c3690

Browse files
committed
Improve artifact naming
Streamline this in CI config
1 parent b357eaa commit b6c3690

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

.github/workflows/build_and_release.yml

Lines changed: 38 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,43 @@ name: Build and release artifacts
33
on:
44
workflow_dispatch:
55
push:
6-
branches:
7-
#- main
8-
- none
9-
paths-ignore:
10-
- README.md
6+
tags:
7+
- "*"
8+
# branches:
9+
# - main
10+
# paths-ignore:
11+
# - README.md
1112

1213
permissions:
1314
contents: write
1415

1516
jobs:
16-
build:
17+
prepare:
18+
name: Prepare release
19+
runs-on: ubuntu-latest
20+
outputs:
21+
tag_name: ${{ steps.release_info.outputs.tag_name }}
22+
release_name: ${{ steps.release_info.outputs.release_name }}
23+
steps:
24+
# If it's a nightly release, tag with the release time. If the tag is `main`, we want to use
25+
# `latest` as the tag name. Else, use the tag name as is.
26+
- name: Compute release name and tag
27+
id: release_info
28+
run: |
29+
# IS_NIGHTLY is currently unused
30+
if [[ $IS_NIGHTLY ]]; then
31+
echo "tag_name=nightly-${GITHUB_SHA}" >> $GITHUB_OUTPUT
32+
echo "release_name=Nightly ($(date '+%Y-%m-%d'))" >> $GITHUB_OUTPUT
33+
elif [[ "${GITHUB_REF_NAME}" == "main" ]]; then
34+
echo "tag_name=latest" >> $GITHUB_OUTPUT
35+
echo "release_name=Latest Release" >> $GITHUB_OUTPUT
36+
else
37+
echo "tag_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
38+
echo "release_name=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
39+
fi
40+
41+
build-and-release:
42+
needs: prepare
1743
runs-on: ${{ matrix.os }}
1844

1945
strategy:
@@ -37,15 +63,6 @@ jobs:
3763

3864
- uses: actions/checkout@v4
3965

40-
- name: Set release version
41-
id: version
42-
run: echo "VERSION=$(cat version.txt)" >> "$GITHUB_OUTPUT"
43-
44-
- name: Print release version
45-
env:
46-
VERSION: ${{ steps.version.outputs.VERSION }}
47-
run: echo "Current release is $VERSION"
48-
4966
- name: Install ninja
5067
if: matrix.os == 'ubuntu-latest'
5168
run: |
@@ -72,12 +89,16 @@ jobs:
7289
- name: Package toolchain
7390
run: ./package.sh
7491

92+
- name: Rename artifact
93+
run: mv ${{ env.ARTIFACT_NAME }}.tar.gz ${{ env.ARTIFACT_NAME }}-${{ needs.prepare.outputs.tag_name }}.tar.gz
94+
7595
- name: Release
7696
uses: ncipollo/release-action@v1
7797
with:
7898
draft: true
79-
tag: "v${{ steps.version.outputs.VERSION }}"
80-
artifacts: "${{ env.ARTIFACT_NAME }}.tar.gz"
99+
name: ${{ needs.prepare.outputs.release_name }}
100+
tag: "${{ needs.prepare.outputs.tag_name }}"
101+
artifacts: "${{ env.ARTIFACT_NAME }}-${{ needs.prepare.outputs.tag_name }}.tar.gz"
81102
allowUpdates: true
82103
omitBodyDuringUpdate: true
83104
omitDraftDuringUpdate: true

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ jobs:
5656
- name: Archive build output
5757
uses: actions/upload-artifact@v3
5858
with:
59-
name: rust-toolchain-${{ matrix.triple }}
59+
name: athena-rust-toolchain-${{ matrix.triple }}
6060
path: |
61-
athena/rust-toolchain-${{ matrix.triple }}.tar.gz
61+
athena/athena-rust-toolchain-${{ matrix.triple }}.tar.gz

config.sh

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,9 @@ fi
1111

1212
export TOOLCHAIN_HOST_TRIPLET=$(rustc --version --verbose | grep 'host: ' | sed -r 's/host: (.*)/\1/')
1313

14-
cd rust
15-
git show --no-patch --format=%ci $RUST_COMMIT > commit_show_output
16-
commit_show_output=$(cat commit_show_output)
17-
rm commit_show_output
18-
cd ../
19-
20-
regex='([0-9]{4}-[0-9]{2}-[0-9]{2})'
21-
if [[ $commit_show_output =~ $regex ]]; then
22-
rust_commit_date="${BASH_REMATCH[1]}"
23-
else
24-
echo "Could not extract date from rustc commit"
25-
exit 1
26-
fi
27-
28-
# Toolchain itself does not need to be versioned by default. It makes referencing it from
29-
# various other projects harder while things are in development. Version can be queried by
30-
# calling `rustc --version` anyway. If someone needs to keep an older version they can
31-
# always rename the folder at install time.
32-
export TOOLCHAIN_NAME=rve-nightly
33-
3414
# Artifact name should be versioned as it is only used at install time.
35-
export ARTIFACT_NAME=rust-rve-nightly-$rust_commit_date-$TOOLCHAIN_HOST_TRIPLET
15+
export ARTIFACT_NAME=athena-rust-toolchain-$TOOLCHAIN_HOST_TRIPLET
3616

3717
if [ "$param1" == "-artifact_name" ]; then
3818
echo "ARTIFACT_NAME=$ARTIFACT_NAME" >> $GITHUB_ENV
3919
fi
40-

0 commit comments

Comments
 (0)