Skip to content

Commit

Permalink
Improve GH action to produce release artifacts (kokkos#7231)
Browse files Browse the repository at this point in the history
* Let the cryptographic hashes also be computed by the release GH action

* Upload all artifacts in the same step

* Attach the cryptographic hashes as release artifact

* Prepend prefix to paths in the archive

* Compute the checksum of both archives in a single step
  • Loading branch information
dalg24 authored Aug 19, 2024
1 parent 6321f17 commit 16eca67
Showing 1 changed file with 10 additions and 22 deletions.
32 changes: 10 additions & 22 deletions .github/workflows/releases.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,23 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- name: Build artifacts
run: |
git archive -o kokkos-${{ github.ref_name }}.zip HEAD
git archive -o kokkos-${{ github.ref_name }}.tar.gz HEAD
git archive --prefix=kokkos-${{ github.ref_name }}/ -o kokkos-${{ github.ref_name }}.zip HEAD
git archive --prefix=kokkos-${{ github.ref_name }}/ -o kokkos-${{ github.ref_name }}.tar.gz HEAD
- name: Generate hashes
shell: bash
id: hash
run: |
# sha256sum generates sha256 hash for all artifacts.
# base64 -w0 encodes to base64 and outputs on a single line.
echo "hashes=$(sha256sum kokkos-${{ github.ref_name }}.zip kokkos-${{ github.ref_name }}.tar.gz | base64 -w0)" >> "$GITHUB_OUTPUT"
sha256sum kokkos-${{ github.ref_name }}.zip kokkos-${{ github.ref_name }}.tar.gz > kokkos-${{ github.ref_name }}-SHA-256.txt
echo "hashes=$(base64 -w0 kokkos-${{ github.ref_name }}-SHA-256.txt)" >> "$GITHUB_OUTPUT"
- name: Upload source code (zip)
- name: Upload artifacts
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: kokkos-${{ github.ref_name }}.zip
path: kokkos-${{ github.ref_name }}.zip
if-no-files-found: error
retention-days: 5

- name: Upload source code (tar.gz)
uses: actions/upload-artifact@834a144ee995460fba8ed112a2fc961b36a5ec5a # v4.3.6
with:
name: kokkos-${{ github.ref_name }}.tar.gz
path: kokkos-${{ github.ref_name }}.tar.gz
name: release-artifacts
path: kokkos-${{ github.ref_name }}*
if-no-files-found: error
retention-days: 5

Expand All @@ -65,19 +58,14 @@ jobs:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Download kokkos-${{ github.ref_name }}.zip
- name: Download artifacts
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: kokkos-${{ github.ref_name }}.zip

- name: Download kokkos-${{ github.ref_name }}.tar.gz
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: kokkos-${{ github.ref_name }}.tar.gz

name: release-artifacts
- name: Upload assets
uses: softprops/action-gh-release@c062e08bd532815e2082a85e87e3ef29c3e6d191 # v2.0.8
with:
files: |
kokkos-${{ github.ref_name }}.zip
kokkos-${{ github.ref_name }}.tar.gz
kokkos-${{ github.ref_name }}-SHA-256.txt

0 comments on commit 16eca67

Please sign in to comment.