Created
July 29, 2020 09:22
-
-
Save weibeld/49c852e4f6f0a57cadbaa547254c2f9d to your computer and use it in GitHub Desktop.
GitHub Actions example workflow — Release Asset Creator
This file contains hidden or 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
name: release-asset-creator | |
on: | |
release: | |
types: [published] | |
jobs: | |
my-job: | |
runs-on: ubuntu-latest | |
env: | |
ARCHIVE_NAME: ${{ github.event.repository.name }}-${{ github.event.release.tag_name }} | |
steps: | |
- name: download-source | |
run: curl -sL "${{ github.event.release.tarball_url }}" >"$ARCHIVE_NAME".tar.gz | |
- name: unzip-source | |
run: mkdir "$ARCHIVE_NAME" && tar -xzf "$ARCHIVE_NAME".tar.gz -C "$ARCHIVE_NAME" --strip-components 1 | |
- name: clean-source | |
run: rm -rf "$ARCHIVE_NAME"/.github | |
- name: create-archive | |
run: tar -czf "$ARCHIVE_NAME".tar.gz "$ARCHIVE_NAME" | |
- name: create-checksum | |
run: sha256sum "$ARCHIVE_NAME".tar.gz >checksum.txt | |
- name: upload-archive | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ${{ env.ARCHIVE_NAME }}.tar.gz | |
asset_name: ${{ env.ARCHIVE_NAME }}.tar.gz | |
asset_content_type: application/gzip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: upload-checksum | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: checksum.txt | |
asset_name: checksum.txt | |
asset_content_type: text/plain | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment