Skip to content

Commit

Permalink
Add upload.yml workflow (#5339)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed May 13, 2024
1 parent efb79db commit 0311d83
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/upload.yml
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/*

0 comments on commit 0311d83

Please sign in to comment.