Skip to content

Commit

Permalink
feat: Add support for multi-file generic artifacts.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Feb 14, 2025
1 parent ea26a8a commit 383e679
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions .github/workflows/deploy-artifact.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,20 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: true
- name: Checkout ci-tools
uses: actions/checkout@v4
with:
repository: iphydf/ci-tools
ref: multi-artifact
path: ci-tools

- name: Run build
run: ${{ inputs.run }}
- name: Generate sha256 checksum
run: sha256sum ${{ inputs.artifact-source }} >${{ inputs.artifact-source }}.sha256
run: for file in ${{ inputs.artifact-source }}; do
sha256sum "$file" >"$file.sha256";
done

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand All @@ -44,34 +53,27 @@ jobs:
${{ inputs.artifact-source }}
${{ inputs.artifact-source }}.sha256
if-no-files-found: error
- name: Compute release file name
if: contains(github.ref, 'refs/tags/v')
id: release-version
run: |
VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)"
echo "artifact=${{ inputs.artifact }}" >>$GITHUB_OUTPUT
- name: Rename artifact for release upload
id: release-version
if: contains(github.ref, 'refs/tags/v')
run: |
cp "${{ inputs.artifact-source }}" "${{ steps.release-version.outputs.artifact }}"
cp "${{ inputs.artifact-source }}.sha256" "${{ steps.release-version.outputs.artifact }}.sha256"
run: VERSION="$(echo "$GITHUB_REF" | cut -d / -f 3)"
ci-tools/tools/rename_artifact.py
"${{ inputs.artifact-source }}"
"${{ inputs.artifact }}"
- name: Upload to versioned release
if: contains(github.ref, 'refs/tags/v')
uses: ncipollo/release-action@v1
with:
allowUpdates: true
draft: true
artifacts: "${{ steps.release-version.outputs.artifact }},${{ steps.release-version.outputs.artifact }}.sha256"
- name: Compute nightly file name
id: nightly-version
run: |
VERSION="nightly"
echo "artifact=${{ inputs.artifact }}" >>$GITHUB_OUTPUT
artifacts: ${{ steps.release-version.outputs.artifacts }}
- name: Rename artifact for nightly upload
id: nightly-version
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
cp "${{ inputs.artifact-source }}" "${{ steps.nightly-version.outputs.artifact }}"
cp "${{ inputs.artifact-source }}.sha256" "${{ steps.nightly-version.outputs.artifact }}.sha256"
run: VERSION="nightly"
ci-tools/tools/rename_artifact.py
"${{ inputs.artifact-source }}"
"${{ inputs.artifact }}"
- name: Upload to nightly release
uses: ncipollo/release-action@v1
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
Expand All @@ -82,4 +84,4 @@ jobs:
omitNameDuringUpdate: true
prerelease: true
replacesArtifacts: true
artifacts: "${{ steps.nightly-version.outputs.artifact }},${{ steps.nightly-version.outputs.artifact }}.sha256"
artifacts: ${{ steps.nightly-version.outputs.artifacts }}

0 comments on commit 383e679

Please sign in to comment.