-
Notifications
You must be signed in to change notification settings - Fork 414
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efb79db
commit 0311d83
Showing
1 changed file
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Upload release | ||
|
||
on: | ||
# https://docs.github.com/en/webhooks/webhook-events-and-payloads#release | ||
release: | ||
types: [published] | ||
|
||
concurrency: | ||
# Concurrency group that uses the workflow name and PR number if available | ||
# or commit SHA as a fallback. If a new build is triggered under that | ||
# concurrency group while a previous build is running it will be canceled. | ||
# Repeated pushes to a PR will cancel all previous builds, while multiple | ||
# merges to main will not cancel. | ||
group: ${{ github.workflow }}-${{ github.ref_name || github.sha }} | ||
cancel-in-progress: true | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
# create source archive and upload it to the published release | ||
# URL to the archive: https://github.com/conda/<repo>/releases/download/<tag>/<repo>-<tag>.tar.gz | ||
upload: | ||
if: '!github.event.repository.fork' | ||
runs-on: ubuntu-latest | ||
env: | ||
ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ github.ref_name }} | ||
steps: | ||
- name: Checkout Source | ||
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | ||
|
||
- name: Create Release Directory | ||
run: mkdir -p release | ||
|
||
- name: Archive Source | ||
run: > | ||
git archive | ||
--prefix="${{ env.ARCHIVE_NAME }}/" | ||
--output="release/${{ env.ARCHIVE_NAME }}.tar.gz" | ||
HEAD | ||
- name: Compute Checksum | ||
run: > | ||
sha256sum "release/${{ env.ARCHIVE_NAME }}.tar.gz" | ||
| awk '{print $1}' | ||
> "release/${{ env.ARCHIVE_NAME }}.tar.gz.sha256sum" | ||
- name: Upload Archive | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
run: > | ||
gh release upload | ||
--clobber "${{ github.ref_name }}" | ||
--repo "${{ github.repository }}" | ||
release/* |